I have a VPS running Webmin/Virtualmin. I host multiple domains, one of which is a Drupal 7 website that uses a MySQL database. Yesterday I went to 'Manage' the database and found that I recieved the following error Lost connection to MySQL server during query and that I can't access it in anyway. I wondered whether it was because my version of MySQL was out of date (it is 5.1.17) so before updated, I tried to back up the database by going to Webmin >> Servers >> MySQL Database Server >> Backup Databases - only to receive the following page:

Database backup failed : mysqldump failed :

mysqldump: Got error: 2013: Lost connection to MySQL server during query when using LOCK TABLES Database backup failed : mysqldump failed :

mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) when trying to connect Database backup failed : mysqldump failed :

mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) when trying to connect Successfully backed up 1348 bytes from database test to file /home/test.sql.

Scheduled backup for database left disabled.

I have set 'Allow big tables?' to Yes and the maximum packet size to 5 MB in the MySQL Server Configuration but I still receive the errors. The file size of the database is only 156 MB, it has 190 tables and it is likely to hold much more data than it does now.

Does anyone have any advice? I'm running CentOS.

UPDATE: Since posting this question, I have been in contact with my hosting company who advised be to upgrade MySQL. I'm now running version 5.5.38 and have exactly the same problem. I installed the latest version of phpMyAdmin and have some strange behaviour. When I try to view the database, it says that the session has timed out but when I log back in no databases appear and I'm told that there are no tables in the database I just clicked on.

1 Answer 1


I found these resources that may help. They explain the errors rather well and what to do about them.

Got error: 2013: Lost connection...

Got error: 2002: Can't connect to...

It sounds like these are fairly simple configuration issues. I hope this helps.

  • Sorry for the slow reply and thank you for your answer, but unfortunately I'm still stuck with the 2013 error. LOCK TABLES seems to be a big clue as that is where the error comes from, but I'm not entirely sure what it means. I've even submitted a support ticket with my hosting company but they appear to be stuck for ideas.
    – Andy
    Jul 29, 2014 at 8:21
  • 1
    Sometimes when no-one has offered an answer, I try and do some research and offer something. I feel like people should get an answer as much as possible. If I can come across something new/different, then I will post again.
    – closetnoc
    Jul 29, 2014 at 15:36
  • 1
    Thank you that is much appreciated. I feel the same way. Soon, I am going to update my question to include my progress.
    – Andy
    Jul 29, 2014 at 15:46
  • Anytime! I like helping people. I will tightening up my answer for future users later today. You may want to see if you can delete the comment with your domain name now that things are fixed.
    – closetnoc
    Jul 29, 2014 at 15:57
  • 1
    @Andy Here is something you can do for now if it is possible. If you have another computer capable of running MySQL, you can install the same version (or very close to it) of MySQL on that computer, stop your problem server, copy the data files from the problem server to the new server, start the problem server, and point the new server to your data files and restart the new server. Your database should appear on the new server. This is at least a work around for now.
    – closetnoc
    Jul 29, 2014 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.