Error 1153 Got a packet bigger than ‘max_allowed_packet’ bytes when importing into the database

After importing a .sql dump file using PhpMyAdmin into a MySQL database I got this error:

#1153 – Got a packet bigger than ‘max_allowed_packet’ bytes

Solved by changing “max_allowed_packet” to 10MB in the MySQL config file my.ini (on the target database only).

Was;

max_allowed_packet = 1M

Changed to:

max_allowed_packet = 10M

 

Importing large .sql files with phpmyadmin

Got this error message when I was trying to import a large (Drupal) SQL-file with PhpMyAdmin:

You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit

While my SQL dump size wasn’t close to my host limit!

My solution was to first clean the Drupal database (login as user one to your drupal site, and browse to update.php. Then execute the Drupal database update.

This way the cache_menu table is cleaned and the db dump file should be significant smaller. My dump went from 120MB to 11MB (uncompressed).

After this cleaning I exported my sql dump file again using gzip compressing. This dump file could be imported with no hassle to my newly created database.