Solving Error 2013: Lost connection to MySQL server during query when dumping table

mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table

If you are constantly getting the error mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table ... then there is a big chance that your queries are large enough that a longer timeout is needed to

 

Check the default value of the net_read and net_write parameter value:

 
show variables like 'net%timeout%'
 

You will see something like:

Variable_name    |Value|
-----------------+-----+
net_read_timeout |30   |
net_write_timeout|60   |
 

Now, try increasing both parameter values to 900:

set global net_read_timeout=900
set global net_write_timeout=900

OR

set @@global.net_read_timeout=900
set @@global.net_write_tiemout=900
 

Verify the parameter value changes:

select @@global.net_read_timeout, @@global.net_write_timeout
 
@@global.net_read_timeout|@@global.net_write_timeout|
-------------------------+--------------------------+
                      900|                       900|
Did this answer your question?
😞
😐
🤩

Last updated on January 30, 2023