Home >Database >Mysql Tutorial >Solution to error 10061 in mysql

Solution to error 10061 in mysql

小云云
小云云Original
2017-12-08 10:04:5513118browse

Sometimes Can't connect to MySQL server on 'localhost' (10061) appears when using mysql. What's going on? In this article, we will share with you the solution to the MySQL error 10061, hoping to help everyone.

Online search method one:

Copy the mysql database to another machine today, but the result is that it cannot connect, and it reports "Can't connect to MySQL server on ' localhost' (10061) "Error
Searched online and found a good article. Two methods can solve this problem
1. Delete my.ini (under C:\windows\) and re-run winmysqladmin, after asking for username and password, the problem is solved!
2. Check whether the localhost in the hosts file points to 127.0.0.1

If the mysql service is not started, you can run net start mysql.
Some related commands:
mysqld-nt --install #Start Mysql
mysql #Run Mysql
mysql -h ipAddress -u username -p

Online search method two:

Solution to 10061 error in mysql

If "ERROR 2003: Can't connect to MySQL server on 'localhost' (10061)" appears,

It means your MySQL has not been started yet. Solution:

The first step

Delete my.ini under c:\windows

The second step

Enter the BIN directory under DOS

C:\Program Files\MySQL\MySQL Server 5.4\bin

Step 3

Enter mysqld -nt -remove under DOS to delete the service

Then enter mysqld -nt -install to install the service

Step 4

Enter net start mysql

mysql started successfully

------ -------------------------------------------------- ------------------------------------------------

Neither of the above two methods can solve my problem.

However, in fact, the above two methods have already talked about the key points. That is, my MySQL has not been started yet. So how to start it.

Enter the BIN directory under DOS

C:\Program Files\MySQL\MySQL Server 5.4\bin

Then, directly enter net start mysql

Then just enter.

The screenshot is as follows:

Or directly

If you encounter such problems at work You can try the above methods.

Related recommendations:

An example of how to solve an error when installing MySQL under Linux

mysql-An error occurred when installing MySQL after reinstalling the system

An example of solving an error in C connection to MySQL under Linux_MySQL

The above is the detailed content of Solution to error 10061 in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn