Can't connect to MySQL server on 'localhost' (10061)

 

 

https://stackoverflow.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.

 

 

 

Reason: caused by ipv6

 

solve:

Method 1:    Modify the configuration bind-address=localhost in the my.in file  , and then restart the mysql service (the test is invalid)

Method 2:  C:\Windows\System32\drivers\etc Modify the hosts file to add the following configuration: (The test is invalid)

               localhost 127.0.0.1

           

 Method 3: Re-download a mysql5.1 version of the msi installation package from the official website, and reinstall it to solve it . (effective, problem solved)

               The problem mysq5.1 is the green free installation version downloaded from the Internet

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326217573&siteId=291194637