max_allowed_packet error during mysqldump

Got a “max_allowed_packet” error during mysqldump. This happened after I added a longblob to one of my tables. Below is the error:

mysqldump --routines --user=root -p localDB > backup.mysql.txt
mysqldump: Error 2020: Got packet bigger than 'max_allowed_packet' bytes when dumping table `table2` at row: 86

It turns out max_allowed_packet is set to something less than whatever is in my row 86. Longblob can go up to 4Gb so I will need to override the max_allowed_packet value.

I found the following way the easiest to re-enable the dump.

mysqldump --routines --max_allowed_packet=100M --user=root -p localDB > backup.mysql.txt

One thought on “max_allowed_packet error during mysqldump

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 )

Facebook photo

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

Connecting to %s