MySQL : How to fix Can't connect to MySQL server on localhost 10061 error

Fixing MySql 10061 error

When I installed MySQL server a few months ago on my Windows 10 machine, I chose to have the database files on my main SSD drive. As it was slowly filling up, I decided to migrate the MySQL database files to another drive. I assumed all I needed to do is to update a path for datadir option in my.ini configuration file, but that didn't work. After the database location move, starting the MySQL server gave me 10061 error "Can't connect to MySQL server" error. Luckily, the fix was quite simple.

I got the following MySQL Workbench Connect error, when starting the MySQL server:

MySQL error - could not connect to MySQL - error code 10061 2003

Could not connect to MySQL: Can't connect to MySQL Server on 'localhost' (10061) (code 2003)

The MySQL Notifier's "Startup Message Log" contained the following:

Starting server...
Server start done.
Checking server status...
Trying to connect to MySQL...
Can't connect to MySQL server on 'localhost' (10061) (2003)
Assuming server is not running

As I mentioned, the datadir option in the main my.ini configuration file didn't work, but I also found my.ini file in the following path C:\ProgramData\MySQL\MySQL Server 5.7. I fixed the datadir path there too, but that didn't do anything.

In the end, the solution that fixed the issue was using the following steps:

  1. In Start Menu, search for "mysql". Among the results, you should see the "MySQL Installer - Community". Run it.
  2. MySQL Installer window will show up as shown below. Find "MySQL Server" under Product and click on "Reconfigure" link.

    MySQL Installer Community

    Click to Enlarge
  3. The MySQL Installer will show up (same one you used for the first MySQL Server installation). Go through all the steps.

    MySQL server installer

    Click to Enlarge

After the MySQL Installer was finished, I started the MySQL service again. This time, the "Startup Message Log" on The MySQL Notifier was showing that the server started successfully:

Starting server...
Server start done.
Checking server status...
Trying to connect to MySQL...
Connection succeeded
Assuming server is running


There are many suggestions on the web about how to solve the MySQL 10061 error. The one that worked for me was to run the MySQL Installer - Community and then choose "Reconfigure" for the MySQL server product. I hope you have found this article helpful. If you fixed this issue using another way, drop a comment and let us know.

Share this page


Add a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to Top