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

2208 查看

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的博客