1、登录mysql,授予远程登录权限(确保mysql表里的登录user对应的host为 % 即可;若不是 % ,使用mysql的update更新对应host)
mysql> use mysql; Database changed mysql> select host, user from user; +-----------+---------------+ | host | user | +-----------+---------------+ | % | root | | localhost | mysql.session | | localhost | mysql.sys | +-----------+---------------+ 3 rows in set (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
2、防火墙开放3306端口
添加需要监听的端口
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
保存设置
/etc/init.d/iptables save
查看状态
/etc/init.d/iptables status
OVER!OVER!