Bài đăng phổ biến

Monday, January 16, 2012

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

Try increasing the value of the max_allowed_packet system variable. Default size is 1MB but it sounds like you are exceeding this. 

To set this add 
max_allowed_packet=64M
(replacing the 64M with whatever value you require) to your config file and restart the server or log into mysql client and issue 
SET GLOBAL max_allowed_packet=67108864

Note: Value in the config file can be followed by M, K to specifiy mb or kb but when using a SET command the value must be given as bytes or as an expression (eg you could specify a 64mb max_allowed_packet using SET GLOBAL max_allowed_packet=64*1024*1024). 


Hopefully this should resolve your problem. 


Sorry forgot to mention that mysqldump also has a max_allowed_packet option and you should try setting this in addition to the above when you run mysqldump. Just start mysqldump with a --max_allowed_packet= option. 

Source: forums.mysql.com