Ubuntu14.04 安装MySQL无法连接

1、修改配置文件:sudo gedit /etc/mysql/my.cnf
查找到bind-address,将 bind-address=127.0.0.1 修改为 bind-address = 0.0.0.0 ,以允许任何IP来访问MySQL服务。


2、重启MySQL服务:sudo /etc/init.d/mysql restart


3、登录MySQL数据库,给需要远程访问的用户授权:
mysql> grant all privileges on test.* to root@"%" identified by "root" with grant option;
本次授权root用户远程访问test数据库的权限,如果你想授权所有数据库,则用*来代替test,就表明全部数据库。


4、刷新配置,使权限立即生效:
mysql> flush privileges;


这时,通过物理主机的MySQL客户端就可以正常登录了。

猜你喜欢

转载自blog.csdn.net/weixin_37976391/article/details/80171210
今日推荐