让虚拟机中的MySQL可以被主机访问

1、VirtualBox对Ubuntu系统进行设置,“网络”选择“桥接网卡”

2、安装MYSQL服务器

sudo su;   apt-get intall mysql-server

3、赋予远程访问的权限:

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option; 

flush privileges;

4、修改绑定地址

vi /etc/mysql/mysql.conf.d/mysql.cnf, 把bind-address=127.0.0.1改成bind-address=0.0.0.0

5、重启MYSQL服务器

/etc/init.d/mysql stop;

/etc/init.d/mysql start;

猜你喜欢

转载自www.cnblogs.com/shuada/p/9297160.html