If you get a packet bigger than ‘max_allowed_packet’ bytes error when importing into a MySQL database on a MAMP system, you need to edit your max_allowed_packet variable. It defaults to 1MB.
There are two ways to do this:
- Create a my.cnf file and set the variable.
- Add --max_allowed_packet=32M to /Applications/mamp/bin/startMysql.sh. Restart MAMP.
The latter method is easier but if you’re going to be editing other variables it’s best to create a my.cnf file. MAMP ships with five my.cnf configuration files (you should be safe with my-small.cnf):
/Applications/MAMP/Library/share/mysql/my-huge.cnf /Applications/MAMP/Library/share/mysql/my-innodb-heavy-4G.cnf /Applications/MAMP/Library/share/mysql/my-large.cnf /Applications/MAMP/Library/share/mysql/my-medium.cnf /Applications/MAMP/Library/share/mysql/my-small.cnf
Copy it to /Applications/MAMP/Library/ and name it my.cnf.
Choose one that works for you and copy it to /Applications/MAMP/Library/my.cnf. Find the max_allowed_packet = 1M line and change it to 32M (or whatever you prefer). Save the file and restart MAMP.