1.检查防火墙
执行iptables -nL --line-number ,查看3306端口是否开放
如未开放
执行 iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
2.修改授权
mysql -uroot -ppassword
use user;
create user test identified by '123456';
grant all privileges on *.* to 'test'@'%' identified by '123456' with grant option;
flush privileges;
3.检查mysql配置
检查mysql配置文件中my.cnf bind-address = 127.0.0.1 是否屏蔽
修改 bind-address = 127.0.0.1 ==》 #bind-address = 127.0.0.1