mysqldump: 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

Facing the error while taking mysqldump of large database. Following is the error

./mysqldump -h servername -u username -p password > /u02/backup/dumpfile.sql

Enter password:

mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table 'salesorder' at row: 4751247

Solution

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

Show variables like 'net%timeout%'

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

Increase the both parameter value to 3600:

SET GLOBAL net_read_timeout=3600

SET GLOBAL net_write_timeout=3600

OR

SET @@global.net_read_timeout=3600

SET @@global.net_write_tiemout=3600

Verify the parameter value changes:

select @@global.net_read_timeout, @@global.net_write_timeout

 

@@global.net_read_timeout|@@global.net_write_timeout|

-------------------------+--------------------------+

                     3600|                      3600|

Run the SQLDUMP backup, hopefully you will not get error. Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.