ERROR 2003 (HY000): Can't connect to MySQL server on '192.16.8.1.22' (111)
或者在Telnet中
1
Connecting To 192.16.8.1.22...Could not open connection to the host, on port 3306: Connect failed
检查防火墙
首先,如果ufw启用了防火墙,请确保您有MySQL规则
1
sudo ufw allow mysql
重启服务
1
sudo service ufw restart
检查MySQL配置
您可能需要bind-address在MySQL配置文件中 注释掉mysqld.cnf
1
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
找到行bind-address (CTRL+ W搜索)
1
/etc/mysql/mysql.conf.d/mysqld.cnf
1 2 3 4
# # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 127.0.0.1