MYSQL远程登录报错: Error No. 2003

解决方法:

1.权限问题
grant all privileges on *.* to 'root'@'%' identified by '密码' with grant option;
flush privileges;
2.在配置文件my.cnf中找到bind-address=127.0.0.1改为0.0.0.0,改完之后重启服务
3.可看机器的防火墙是否关闭。
查看防火墙状态:sudo ufw status
关闭防火墙:ufw disable
开启防火墙:ufw enable

另:

1. 如果是权限问题, 可以用sql查看下:

mysql> use mysql;

mysql> select host,user from user;

如果没有% root, 只有localhost root,那就说明只能localhost用root访问,需要修改权限!

2. linux下修改my.cnf

sudo vi my.cnf

posted on 2011-07-04 01:13  DavidYanXW  阅读(2401)  评论(0)    收藏  举报