Bobcares

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

by | Jan 28, 2019

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.

 

Solution

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.

 
Solution

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.

 

Solution

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.

 

Solution

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.]

 

Conclusion

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.

 
 
 
 
 
 

PREVENT YOUR SERVER FROM CRASHING!

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.

SEE SERVER ADMIN PLANS

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

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

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

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF