查看是否端口号被禁用
iptables -nL
被禁用,开放端口号:
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
再次查看
这时权限已经放开;
本地登陆mysql,执行:
grant all privileges on *.* to 'root'@'%';
flush privileges;
这时就可以远程登陆了。
修改root密码:
grant all privileges on *.* to 'root'@'%' identified by 'password';
创建所有都能登陆的root,并赋予密码
如果不行,创建一个具有root权限的test用户,
grant all privileges on *.* to test@'%' identified by '123456';
在后台创建root@%,再执行已上内容
grant all privileges on *.* to 'root'@'%';
flush privileges;