Can't connect to MySQL server on 'localhost' (10061) 博客分类: mysqlwin7 mysqIPv6
https://*.com/questions/10792862/rails-development-cant-connect-to-mysql-server-on-localhost-10061
My best guess is that the machine, which you indicated as Windows, has IPv6 networking enabled. Thus when you try to go to localhost, it is resolving to "::1". This is in fact the local machine, however, default MySQL installs normally have bind-address set to 127.0.0.1, which would cause localhost to fail in this setup.
You might be able to verify this by running ping localhost
from the command prompt, and seeing if you get a response like:
Reply from::1: time<1ms
To fix this, you can change your config to specify:
host:127.0.0.1
Alternately, you can change MySQL's configuration to allow a different bind-address, e.g. localhost instead of 127.0.0.1.
原因:ipv6造成的
解决:
方法1: my.in 文件修改配置 bind-address=localhost,然后重启mysql服务 (测试无效)
方法2: C:\Windows\System32\drivers\etc 修改hosts文件添加如下配置:(测试无效)
localhost 127.0.0.1
方法3: 官网重新下载一个mysql5.1版本的msi安装包,重新安装了一遍解决.(有效,问题解决)
出问题的mysq5.1是网上下载的绿色免安装的版本
推荐阅读
-
Can't connect to MySQL server on 'localhost' (10061) 博客分类: mysqlwin7 mysqIPv6
-
mysql提示Can t connect to MySQL server on localhost (10061)
-
Can t connect to MySQL server on localhost (10061)
-
Navicat premium连接数据库出现:2003 Can't connect to MySQL server on'localhost'(10061)
-
Can't connect to MySQL server on localhost (10061)解决方法
-
Can't connect to MySQL server on localhost (10061)解决方法
-
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)解决办法
-
Can't connect to MySQL server on 'localhost' (10061)问题描述及解决办法
-
Can't connect to MySQL server on localhost (10061)解决方法_MySQL
-
mysql提示Can t connect to MySQL server on localhost (10061)