mysqldump: Error 2020: Got packet bigger than ‘max_allowed_packet’ bytes when dumping table

If we are dumping big db’s we can see this error usually , because the default value of max_allowed_packet is 25M.

Solution :-

Two ways you can fix this

1) Add the following in your /etc/my.cnf and restart mysql

max_allowed_packet = 500M

2) Use mysqldump with the option –max_allowed_packet

mysqldump -u root -p --max_allowed_packet=512M  -B  databaseName  -- tables  tablename > dbname.sql