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

Posted 学习、实践、总结

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了让虚拟机中的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;

 

以上是关于让虚拟机中的MySQL可以被主机访问的主要内容,如果未能解决你的问题,请参考以下文章