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

昨天早上刚到公司,有同事反映一台Mysql不能远程访问。错误如下:


[mysql@CRM01 ~]$ mysql -ucrmuser -pCrm@251  -h 192.168.0.251
Warning: Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.0.251' (111)

但在另一台机器可以正常访问:
[mysql@CRM02 ~]$ mysql -ucrmuser -pCrm@251  -h 192.168.0.251
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1840174

问是何原因。

1.先检查了mysql的用户权限发现,CRM01和CRM02的IP都有权限访问mysql


2.查看MYSQL主机的防火墙,也没有做限制

3.从CRM01主机上  telent mysql的3306端口也是通的
  telnet 192.168.0.251 3306

 

有点想不明白:
a). mysql的权限和防火墙都没有限制

b). telnet mysql的端口也是通的

c.) 两台机器用一样的命令访问同一个mysql,

为什么一个可以,一个不可以呢?

在换一台机器访问,用同样的命令访问mysql也是可以的。 于是判定问题不在mysql本身,而在访问myslq的客户端。


怎么办呢?加个端口试试吧。一试果然ok。


[mysql@CRM01 ~]$ mysql -ucrmuser -pCrm@251  -h 192.168.0.251 -P3306
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1840162

可是为什么只在这台机器上要加3306端口,才能访问通, 而其它的两台机器不用指定3306端口也能访问通呢。


由于手头比较忙,暂且记下,以后有机会多关注一下。谁遇到过类似的问题,请赐教。

 


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值