一、更改root 用户密码
mysql -u root -p
use mysql
UPDATE user SET Password = PASSWORD('newpassword') WHERE user = 'root';
FLUSH PRIVILEGES;
二、设置远程连接
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
FLUSH PRIVILEGES;
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT