Can t connect to mysql server on localhost 10061 ubuntu

When you are working with a MySQL database, you might run into this error:

2003 - Can't connect to MySQL server on '127.0.0.1' (or some other host)

There might be several causes for that error, so you can try these methods to find out what the problem is.

1. Check for typos

A small typo in the MySQL server name, database name, username, port, etc. can lead to this error, so make sure you got them right 100%.

2. Make sure MySQL server is running

Maybe the problem is that there is no MySQL server running at the specified host. So the first thing you should do is to verify the status of MySQL Server. It’s recommended to try restarting the MySQL server.

You might need to check the port that it’s listening to, the default port is 3306.

If you are using DBngin to manage the local server, launch DBngin and see if the server is still on. If not, start it.

Can t connect to mysql server on localhost 10061 ubuntu

3. Connection to the MySQL server is not allowed using TCP/IP

You need to make sure that your MySQL server was not started with the --skip-networking option. You should find the setting in the MySQL configuration file (my.ini on Windows, my.cnf on Unix/Linux).

If it was, remove it and restart MySQL server for the change to take effect.

For remote connections, you need to confirm that MySQL remote access is enabled. By default, MySQL listens for connections only from localhost. Go check the MySQL configuration file and give the bind-address as the IP address of the server where MySQL service listens.

You could also try increasing the max_connection parameter in the MySQL configuration file.

4. There is a networking issue blocking access to MySQL

It could be a network firewall blocking the connection. Most often it will help to uninstall and reinstall the firewall.

5. Still no help at all?

If you tried all above and none of them worked, try connecting using SSH Tunnelling instead and see if it helps.

For more information, visit MySQL Reference Manual.


Need a good MySQL GUI? TablePlus provides a native client that allows you to access and manage MySQL and many other databases simultaneously using an intuitive and powerful graphical interface.

Download TablePlus for Mac.

Not on Mac? Download TablePlus for Windows.

Need a quick edit on the go? Download for iOS

Can t connect to mysql server on localhost 10061 ubuntu

Question

I have already a sistem loaded on digital ocean using a mysql database and is working perfectly, but the problem is that i can’t connect using mysqlworkbench to the database and i getting the error Can’t Connect to MySQL Server on IPAddress (10061)

Im new using this services of digital ocean, so i don’t know what is wrong on my settings to access the database. (which is actualy working for the system).

I don’t know what to configure over the mysqlworkbench to access the database:

1)Shall I use a tcp/ip or tcp/ip / ssh ??

Thanks for your support Rgds


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

A few months ago, when I installed MySQL server on Windows 10 to run WordPress locally, 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 the 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:

Can t connect to mysql server on localhost 10061 ubuntu
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 for me was to reconfigure the MySQL Install.

To reconfigure the MySQL install, we do the following steps:

  1. In Start Menu, search for "mysql". Among the results, you should see the "MySQL Installer - Community". Run it.

    Note: If you don't find it, open the Windows Explorer and find the MySQLInstaller.exe file inside the following path for Windows 10:
    C:\Program Files (x86)\MySQL\MySQL Installer for Windows\

  2. MySQL Installer window will show up as shown below. Find "MySQL Server" under Product and click on "Reconfigure" link.

    Can t connect to mysql server on localhost 10061 ubuntu

    Click image to enlarge

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

    Can t connect to mysql server on localhost 10061 ubuntu

    Click image 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

Conclusion

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.

Can't connect to MySQL server on localhost in Ubuntu?

Check Firewall If you still can't connect, check if there is a firewall configured on your server. The most common firewall for Ubuntu server is ufw .

Can't connect to MySQL server 10061 query?

The error (2003) Can't connect to MySQL server on ' server ' (10061) indicates that the network connection has been refused. You should check that there is a MySQL server running, that it has network connections enabled, and that the network port you specified is the one configured on the server.

How do you fix MySQL can't connect to localhost?

Note: Stop the XAMPP server before following the steps..
Step 1: Reconfigure MySQL server to port 3306. Click Start and open MySql installer - community. ... .
Step 2: Reconfigure XAMPP to use a different port other than 3306. Open XAMPP and change the port other than 3306 in two files..

How do I access MySQL server on localhost?

Enter 127.0. 0.1 for the host. The default username for a new MySQL installation is root, with a blank password. You can leave the port field blank unless your server uses a different port than 3306.