cPanel Mysql远程连接错误2003(HY000)

时间:2015-03-04 15:27:24

标签: mysql cpanel remote-access

Mysql服务器在共享主机盒上没有问题 PHP工作正常,连接到mysql并通过apache提供网站服务。 cPanel没有问题。

去特定帐户的cPanel并添加到“Remote MySql”远程主机IP,当这不能使用通配符以允许任何人连接('%')。

my.cnf内容:

[mysqld]
local-infile=0

max_connections=200
table_open_cache=256
max_delayed_threads=20
max_tmp_tables=32
query_cache_type=1
query_cache_size=4M
thread_cache_size=4
innodb_file_per_table=1
open_files_limit=30428
max_allowed_packet=268435456
bind-address = x.x.x.x

innodb_buffer_pool_size=8M
[mysqldump]
events

注意:在绑定地址和我的服务器的主要和辅助ips中尝试了0.0.0.0。也尝试没有任何绑定地址

尝试连接时

tcpdump输出:

#tcpdump -i any port 3306
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
16:52:24.382293 IP x.x.x.x.59222 > x.x.x.x.mysql: Flags [S], seq 4293479800, win 29200, options [mss 1380,sackOK,TS val 4646672 ecr 0,nop,wscale 7], length 0
16:52:25.379861 IP x.x.x.x.59222 > x.x.x.x.mysql: Flags [S], seq 4293479800, win 29200, options [mss 1380,sackOK,TS val 4646922 ecr 0,nop,wscale 7], length 0
16:52:27.383794 IP x.x.x.x.59222 > x.x.x.x.mysql: Flags [S], seq 4293479800, win 29200, options [mss 1380,sackOK,TS val 4647423 ecr 0,nop,wscale 7], length 0
16:52:31.387599 IP x.x.x.x.59222 > x.x.x.x.mysql: Flags [S], seq 4293479800, win 29200, options [mss 1380,sackOK,TS val 4648424 ecr 0,nop,wscale 7], length 0
16:52:39.403709 IP x.x.x.x.59222 > x.x.x.x.mysql: Flags [S], seq 4293479800, win 29200, options [mss 1380,sackOK,TS val 4650428 ecr 0,nop,wscale 7], length 0
16:52:55.419900 IP x.x.x.x.59222 > x.x.x.x.mysql: Flags [S], seq 3596828352, win 29200, options [mss 1380,sackOK,TS val 4654432 ecr 0,nop,wscale 7], length 0
6 packets captured
6 packets received by filter
0 packets dropped by kernel

IPTABLES RULES

Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     tcp  --  all    any     anywhere             anywhere            tcp dpt:mysql 
  36M 6414M acctboth   all  --  any    any     anywhere             anywhere            
    0     0 ACCEPT     tcp  --  !lo    any     ns5.servint.net      anywhere            tcp dpt:domain 
    0     0 ACCEPT     udp  --  !lo    any     ns5.servint.net      anywhere            udp dpt:domain 
    0     0 ACCEPT     tcp  --  !lo    any     ns5.servint.net      anywhere            tcp spt:domain 
....

netstat输出

#netstat -nat |grep :3306
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN  

仍然没有运气。无法使用相同的错误连接到Mysql:

ERROR 2003(HY000):无法连接到'x.x.x.x'上的MySQL服务器(110)

1 个答案:

答案 0 :(得分:0)

这可能过于简单了,但是你重启了Mysql吗?

您的错误与配置中没有绑定地址的配置一致,但我确实看到了您的错误。我只是想知道配置是否已经加载,因为你编辑它: ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)

另外,您是否在Cpanel中尝试了实际的IP地址而不是通配符,以便为Mysql用户配置远程访问?

我希望这有帮助!