mysql -u root -p
修改mysql库的user表,将host项,从localhost改为%。%这里表示的是允许任意host访问,如果只允许某一个ip访问,则可改为相应的ip
mysql> use mysql;
mysql> update user set host = '%' where user = 'root';
mysql> select host, user from user;
mysql> flush privileges;
重启mysql服务
/etc/init.d/mysqld restart
防火墙开放3306端口
iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 3306 -j ACCEPT
耐得住寂寞,才能登得顶 Gitee码云:https://gitee.com/lyc96/projects