1.开放防火墙 3306端口,重启防火墙
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
/etc/rc.d/init.d/iptables save
service iptables restart
2.添加root 远程权限
mysql -h localhost -P3306 -u root -p ******
use mysql
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'php' WITH GRANT OPTION;
flush privileges;
3.重启mysql
service mysql restart
ps. 注意有的直接update mysql.user表,需要重新update Password=password('mysql'),再flush生效。