本文主要是介绍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的贡献,这个很有用
这篇关于ERROR 2003 (HY000): Can't connect to MySQL server on (10061)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!