1. 程式人生 > >【解決】ERROR 2003 (HY000): Can't connect to MySQL server on "host" (113)

【解決】ERROR 2003 (HY000): Can't connect to MySQL server on "host" (113)

連線遠端MySQL時報錯:

ERROR 2003 (HY000): Can’t connect to MySQL server ‘ip’ (113)

檢視錯誤型別(Linux系統)

perror 113

結果如下:
OS error code 113: No route to host

導致此錯誤的原因為伺服器端防火牆未開放MySQL程式使用的埠,預設為3306,開放埠即可

/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT 

儲存設定並重啟防火牆

service iptables save
service iptables restart