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

在linux系统上装了一个mysql-5.5,启动后本机都是可以访问的,操作都正常,同时建了一个%的用户(支持远程访问),

root@debian:/# mysql -u loongson -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 39
Server version: 5.5.40-0+wheezy1 (Debian)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)

mysql> 


但是用别的电脑连接就是报错

C:\Users\Administrator>mysql -h 192.168.1.109 -u -loongson -p
Enter password: ******
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.1.109' (10061)

上网查了很多资料,有的说是用户没有设置权限,但是我的已经设置好了

mysql>  SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
+---------------------------------------+
| query                                 |
+---------------------------------------+
| User: 'loongson'@'%';                 |
| User: 'root'@'127.0.0.1';             |


有的说在my.cnf中添加

skip-name-resolve

加后重启还是不行

最后看了 dkcndk 的博客 cnblogs.com/dkblog/archive/2008/06/27/1980793.html

my.ini(my.cnf)默认的bind-address是127.0.0.1,这样的话就算你创建的用户有可以remote访问的话 也不能通过-h 来访问。 mysql只接受localhost。 所以把bind-address屏蔽掉即可。

找到自己的my.cnf修改,重启,问题果然解决,非常感谢dkcndk的贡献,这个很有用

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值