ERROR 2003 (HY000): Can't connect to MySQL server (111)

1、修改配置文件
vim /etc/mysql/my.cnf
修改bind-address = 0.0.0.0
2、授权
GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘sjgj2508’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
3、重启mysql
sudo service mysql restart
4、修改防火墙规则
sudo iptables -A INPUT -i eth0 -s 192.168.1.0/24 -p tcp –destination-port 3306 -j ACCEPT

原文链接:跨服务器连接mysql报错ERROR 2003 (HY000): Can’t connect to MySQL server on ‘192.168.1.168’ (111)–FrancisSoung的博客

    原文作者:FrancisSoung
    原文地址: https://segmentfault.com/a/1190000003017725
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞