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

First check that the MySQL service is not started "If it is not started, you need to start this service.

Sometimes after installing mysql, use the mysql command to report an error Can't connect to MySQL server on localhost (10061), or use net start mysql when the service name is invalid, generally because the mysql service is not started.

 

 At this time, you can run cmd.exe as an administrator (note that you must run as an administrator), otherwise it will report Install / Remove of the Service Denied! You can find cmd.exe in the path below, and right-click to run as an administrator.

Several running methods of cmd under administrator authority

1. Win + R opens the running window.

 

 2. Right-click on the found cmd.exe, select it, and run as administrator.

 

 

The second method

After entering CMD in the direct search bar (do not press Enter immediately), press and hold the CTRL+SHIFT+ENTERkey to directly enter the administrator mode command line.

 

Then add mysql to the Windows service. Switch to the bin folder under the mysql installation directory, and run "mysqld --install" from the command line.

C:\Program Files\MySQL\MySQL Server 5.6\bin>mysqld --install

At this point, use "net start mysql" to successfully start msyql, generally you can start mysql normally

 

Details link: https://www.jb51.net/article/26505.htm

 

Guess you like

Origin www.cnblogs.com/mike-mei/p/12735214.html