error message:
mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table xxx at row: 258609
I looked at it online and probably said that during mysqldump
, because the amount of data is too large to receive so much data at one time, the data sent from the server will be backlogged in memory waiting to be sent. This waiting time is the time of net_write_timeout
. When this time is exceeded, mysqldump
will be disconnected and an error will be thrown: error 2013: Lost connection
.
Most of the Internet say that you can modify the net_write_timeout time. For example, change to 1200.
mysql -u root -p
show global variables like '%timeout%'
set global net_write_timeout = 1200
show global variables like '%timeout%'
mysqldump -uroot -p -B monitor> /var/www/mysqlbackup/db.xxx.sql
During the above operation, there is no need to restart mysql. It may be that this value will not be reset to the default value within a certain period of time after exiting mysql. If it doesn't work, try restarting: service mysqld restart
.
In addition, this net_write_timeout
time, it is best to change back to the default value after the operation of mysqldump
.