Are you getting failed backups with an error similar to: mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table ....
If so there are several options you can try to resolve:

  1. it is possible that the backup is hitting the MySQL timeout limits.

The particular variables in question here are net_read_timeout and net_write_timeout which are set to 30 and 60 seconds respectivley.
You can change these in the my.cnf config file by setting them as you desire. Here is an example. After making these changes to my.cnf you must restart MySQL

net_read_timeout = 120
net_write_timeout = 900

If you prefer to change these settings without needing to reboot MySQL you can do that with the following SQL statements:

set global net_read_timeout = 120;
set global net_write_timeout = 900;

Again, use the value for these settings that you feel is appropriate for your setup.

2) Increase max_allowed_packet setting

You might try increasing the max_allowed_packet configuration setting. You could try setting it to 256M or even up to 1G

3) You could have a corrupt table

Sometimes "Lost connection" errors are caused by a corrupt table. You could try setting innodb_force_recovery = 1 and restart mysql to see if that helps. If it does, doing the dump might fix the page cache in which you can often turn this back to 0 or remove.


We hope you find this helpful! If you need any further assistance, please contact us and we'll be more than glad to help you out.Β 

Did this answer your question?