I needed to import a large (~400MB) db for local testing. I did a mysqldump on the server, treat zipped, information pills and then ftp’d it to my local machine where I was going to poke around with it using MAMP. However when I tried to import it via the command line, it would barf eventually with the error “ERROR 1153 (08S01) at line 988: Got a packet bigger than ‘max_allowed_packet’ bytes” message. Here’s how to fix it.
In Terminal cd to mamp’s bin folder:
try to import the database:
./mysql -u username -p database < /path/to/file_to_import.sql
you’ll probably get an error like:
ERROR 1153 (08S01) at line 988: Got a packet bigger than ‘max_allowed_packet’ bytes
What you want to do is fix the ‘max_allowed_packet’ size in the my.cnf file. But where is it in MAMP? It’s actually nowhere. There are a few sample files that you can use and then copy to a certain directory. I got that info from http://forum.mamp.info/viewtopic.php?f=2&t=6306#p12075
I copied the conf (my-large.cnf) file from /Applications/MAMP/Library/share/mysql to /Applications/MAMP/db/mysql/
Rename it my.cnf
Edit the settings as needed (username, password, port)
I needed to change the port from 9999 to 3306
And I bumped up the max_allowed_packet size to 64mb just to make sure it really imported the file
Retry the import command
It should work. If not, try bumping up the max_allowed_packet size again. You can always lower it when you’re done.