I'm running mysqldump on a mysql server in a cron (as backup) and I'm getting warning messages like

mysqldump: Got error: 2013: Lost connection to MySQL server during query when doing refresh

What does this MySQL error (2013) mean? I've done some googling and it's not very helpful...

For the record, mysqldump is connecting to a MySQL Slave server, it used to work when it was connecting to a master.


This could be very bad, 2013 means that the thread servicing the mysqldump process has died. This could be because the InnoDB engine on the server has detected an error while reading the database file for you database. As mysqldump has to read all the pages for all of your database to make the backup it is likely to trigger any latent corruption that your application may avoid during it day to day activity.

If you run your mysql command and it reports that your connection id is a low number then you server has probably restarted itself. You should check your mysqld.log immediately to find out why.

  • thanks for accepting my answer, what did you find in your mysqld.log ? – Dave Cheney Jun 24 '09 at 9:57
  • I saw the low connection id which means the server restarted. I'm not sure why yet. How do I check for 'latent corruption – Rory Jun 24 '09 at 10:09
  • 1
    If your mysql sever has restarted itself there will be a large (read pages of debug) in the mysql log. – Dave Cheney Jun 24 '09 at 10:30

2013 means that the connection to the server went away. There are several possibilities off hand:

  1. Someone KILLed the query
  2. Network problems caused the connection to die
  3. The server crashed/died
  4. Your connection was idle for wait_timeout and was killed
  5. The client wasn't pulling data fast enough for net_wait_timeout and was killed
  • 1
    Is it net_write_timeout or net_wait_timeout? – ks1322 Dec 7 '18 at 17:42

do you open the connection, do a lengthy operation not involving the connection, and then attempt the query? if that is the case mysql probably dropped the connection due to the wait_timeout. simply re-connect before issuing the query.

protected by Zypher Nov 2 '10 at 20:05

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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