mysqldump: Got packet bigger than ‘max_allowed_packet’ bytes


When you dump table data from MySQL, you may end up pulling a large chunk of data and it may exceed the MySQL client’s max_allowed_packet variable. If that happens, you might catch an error like this:

mysqldump: Error 2020: Got packet bigger than 'max_allowed_packet' bytes when dumping table `tablename` at row: xxxx

The default max_allowed_packet size is 16M, and you can adjust it for good within your my.cnf by setting the variable in a section for mysqldump:

max_allowed_packet = 500M

You can digit the max_allowed_packet directly in to the string command. Example:

mysqldump -u root -p –-max_allowed_packet=512M -B dbname –tables tblnames > filename.mysql

Source with some modifications