Yesterday I was migrating a site from a shared host to my local dev environment (MAMP on Snow Leopard) when I hit a curious error message just after migrating the database: "Got a packet bigger than 'max_allowed_packet' bytes". This error was thrown by the update module when writing to the watchdog table. I have quite a few modules installed and apparently the insert statement was too long for my MYSQL configuration. Apparently people are encountering the error both during a database import and as in my case, after the import. After some web searches I was able come up with some solutions.
If you get the error during the migration:
When you export the database with phpMyAdmin make sure you turn off "extended inserts" on the export page
and set the maximal length of the query to 50000. Extended inserts combine multiple rows into one insert statement thus increasing the packet size.
If you get the error after the migration:
- Copy /Applications/MAMP/Library/support-files/my-small.cnf to directory /Applications/MAMP/db/mysql if using MAMP 1.x or /Applications/MAMP/conf/my.cnf if using MAMP 2.x, and rename it my.cnf.
- Edit the file and change the max_allowed_packet value from 1M to 16M. Then restart your MYSQL server (you can do this with the MAMP application).
Also use the second method if you cannot regenerate the database file.
As always your comments are welcome.