MAMP : Solve the “max_allowed_packet” value problem.

July 26th, 2017

Today i moved a website from production to local.

First of all i backup all my files, and store them in a ” httdocs/my_project_name ” MAMP folder.

Make a DUMP of the production database, and import under myPhpAdmin ( on local )

Here starts problems ;-) ;-) ;-)

I had an error ” packet bigger than ‘max_allowed_packet’ bytes “ that say the insert statement was too long for my MYSQL configuration.

We need to change this value on our “my.cnf” file.

Copy the file “my-small.cnf” that you find in “Applications/MAMP/Library/support-files/”, and paste in ” /Applications/MAMP/db/mysql ” and rename in “my.cnf”.
Now open my.cnf with a code editor ( i use visual studio code ), and modify the max_allowed_packet ( are 2 voices ) value from 1M to 16M or 32M.

Then restart your MYSQL server (you can do this with the MAMP application).

Rerun import one more time and, if all is right, all run without problems.