我有一個在Debian服務器上運行的MySQL實例,我可以在本地連接到它,沒有任何問題。但是,我無法遠程連接到它。當我嘗試這從我的命令行,我得到以下錯誤:試圖連接到遠程MySQL主機(錯誤2003)
ERROR 2003 (HY000): Can't connect to MySQL server on '<server-ip>' (110)
我已經添加了用戶MySQL作爲「localhost」的「用戶」 @「*」和「用戶」 @。此服務器中的skip-networking設置爲false,並在my.cnf中將綁定地址註釋掉。我也嘗試使用以下命令iptables中打開端口3306:
/sbin/iptables -A INPUT -i eth0 -p tcp --destination-port 3306 -j ACCEPT
這裏是我的所有的iptable防火牆規則的列表,這是我使用iptables retreived -L:
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT all -- anywhere anywhere
REJECT tcp -- anywhere anywhere tcp dpt:auth reject-with icmp-port-unreachable
ACCEPT icmp -- anywhere anywhere icmp type 8 code 0 state NEW,RELATED,ESTABLISHED,UNTRACKED
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere tcp spts:1024:65535 dpt:ftp state NEW
ACCEPT tcp -- anywhere anywhere tcp spts:1024:65535 dpt:ssh state NEW
ACCEPT tcp -- anywhere anywhere tcp spts:1024:65535 dpt:www state NEW
ACCEPT tcp -- <my-server> anywhere tcp spts:1024:65535 dpt:mysql state NEW
ACCEPT tcp -- anywhere anywhere tcp dpts:49152:65534 state NEW
ACCEPT tcp -- anywhere anywhere tcp dpt:mysql
LOG all -- anywhere anywhere limit: avg 5/min burst 5 LOG level debug prefix `iptables denied: '
ACCEPT tcp -- anywhere anywhere tcp dpt:mysql
LOG tcp -- anywhere anywhere tcp dpt:mysql LOG level debug
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
不任何人有任何想法我應該從哪裏去?
當您在3306上telnet到時會發生什麼? –
2011-04-19 09:10:15
@Mike:我收到消息「telnet:無法連接到遠程主機:連接超時」。 – hellsgate 2011-04-19 09:18:42
錯誤2003在這裏詳細:http://www.webyog.com/faq/content/23/15/en/error-no-2003-can_t-connect.html – 2012-08-10 10:42:27