Tuesday, 13 May 2014

'MySql server has gone away' with phpmyadmin using MAMP 2.0.5


In phpmyadmin under MAMP 2.0.5, I get the error 'MySql server has gone away' when trying to import a large .sql file.


There are a few things that can cause this issue, however one common one is the MySQL max packet size being too small. By default, it's set to about 1MB.

To fix this under MAMP 2.0.5, you can add a custom configuration setting to increase the max packet size by using the following instructions:

  • Stop MySQL Server (or stop all MAMP servers)
  • In /Applications/MAMP/conf/ create a my.cnf file if it does not exist
  • Add the following to the my.cnf file:
    max_allowed_packet = 64M
  • Save the my.cnf file
  • Restart MAMP servers

If this did not quite solve the problem, you can check out this Stack Overflow post for additional my.cnf configurations to try.