Need help?

Our experts will login to your server within 30 minutes to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price per month.

“mysqldump error 2003” – Here are the 3 important points to check

Mysqldump is a useful tool for server owners to fully backup their databases.

However, many users come up with errors while doing a backup or restore using this tool. And, one such error is “mysqldump error 2003“.

At Bobcares, we help server owners resolve these errors as part of our Server Management Services.

Today, we’ll discuss the top 3 reasons for this error and how we fix them.


“mysqldump error 2003” – A Brief explanation

“Mysqldump error 2003” means that the network connection has been refused. And, users see the complete error message like this when using the mysqldump command.

mysqldump: Got error: 2003: Can't connect to MySQL server on 'localhost' (10061) when trying to connect


This may be due to the downtime of MySQL service, disabled network connections, and more.


“mysqldump error 2003” – Why & How to fix?

We got a clear understanding of this error. Let’s now see the main reasons for this error and how our Support Engineers fix them.

1) MySQL service downtime

This error occurs usually if the MySQL service is not running on the server. There are scenarios in which MySQL server  doesn’t automatically start after server reboots. Similarly, intermittent MySQL service crashes can also cause this error.

And, users see the ‘mysqldump error 2003‘ when trying to backup/restore the database.



Firstly, our Hosting Engineers check if the MySQL service is running on the server. For example on Linux servers, we use the following command to check the status of the MySQL service.

ps aux | grep mysql


If the MySQL service is down or doesn’t respond, we’ll kill the MySQL dead processes and restart the service. Moreover, we modify the server configuration to start the MySQL service automatically during server reboot.

Similarly, intermittent service crashes can occur due to resource outages, heavy traffic, DDoS attacks, corrupted data files or index files, and more. Here, our Server Experts checks the server error logs to determine where the MySQL service failed and fix that issue.

[MySQL service keeps crashing on your server? Click here to get an experienced MySQL expert to fix it for you.]


2) MySQL running on custom port

The default port of MySQL is 3306. But, server owners prefer to use a custom port to improve security. So, in such cases users should explicitly specify the MySQL port to perform database operations.

In other words, if users use a custom MySQL port and use the mysqldump command without a custom port, the MySQL server will look for the default MySQL port and throws this error.


Our Hosting Engineers use the netstat command to find the right port on which the MySQL service is listening.

netstat -lnp | grep mysql


Once we have identified the correct MySQL port, we suggest customers to use the MySQL port explicitly in the mysqldump command. For example, see the below command.

mysqldump -u root -p password -P customport databasename > backup.sql


In addition to that, we confirm that there are no syntax errors in the mysqldump command issued by the user.


3) MySQL socket issues

MySQL socket file is a pseudo file used by the server and clients to exchange requests and data. So, a missing socket file or wrong permissions of the socket file can lead to this error.

a) Missing MySQL socket file

The default location of MySQL socket file is /tmp/mysql.sock. In some servers, any users can delete the files in the /tmp directory which can lead to problems. We’ve seen cases where users mistakenly delete this file or create a custom cron to remove older files in /tmp folder.



Firstly, our Hosting Engineers check if the MySQL socket file that mysqladmin tries to access really exists. If not, we’ll restart the MySQL service which will create the mysql.sock file again.

Further, we protect the /tmp directory, so that the files can only be removed by their owners or root users. Alternatively in some cases, we change the default location of the MySQL socket. Similarly, if we find any cron entries removing the MySQL socket files, we’ll remove it from the server.

b) Wrong permission of MySQL socket file

Sometimes, the server has no proper access rights for the MySQL socket file or the directory that holds the MySQL socket file. If the server can’t access the socket file to communicate, it leads to this error.



Our Support Engineers correct the access privileges for the socket file and the directory, so that the server can connect to MySQL socket file for communication.

[And, do you need a MySQL Expert to look into this issue? Click here, we are online 24/7.]



In short, mysqldump error 2003 can occur due to MySQL service downtime, MySQL socket issues, and so on. Today, we’ve discussed the top 3 reasons for this error and how our Support Engineers fix this problem.


Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.


Submit a Comment

Your email address will not be published. Required fields are marked *