Home >Database >Mysql Tutorial >Mysql cannot connect and error message 10061 appears. What should I do?
Mysql cannot connect and error message 10061 appears. Solution: 1. Delete my.ini, re-run winmysqladmin, and then start the mysql service; 2. Enter the BIN directory under DOS and enter [mysqld -nt -remove ], and then start the mysql service.
The operating environment of this tutorial: Windows 7 system, mysql version 8.0.22, DELL G3 computer.
The solution to error message 10061 when mysql cannot connect:
Online search method one:
Put the mysql database today Copied it to another machine, but failed to connect and reported "Can't connect to MySQL server on 'localhost' (10061)" error
I searched online and found a good article with two methods All can solve this problem
1. Delete my.ini (under C:\windows\), re-run winmysqladmin, and after asking for user name and password, the problem is solved!
2. Check whether 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 #启动Mysql mysql #运行Mysql mysql -h ipAddress -u username -p
More related free learning recommendations: mysql tutorial(Video)
Online search method two:
Mysql error 10061 solution
If "ERROR 2003: Can't connect to MySQL appears" server on 'localhost' (10061)",
means that 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
Related free learning recommendations: mysql video tutorial
The above is the detailed content of Mysql cannot connect and error message 10061 appears. What should I do?. For more information, please follow other related articles on the PHP Chinese website!