Showing posts with label phpmyadmin. Show all posts
Showing posts with label phpmyadmin. Show all posts

Tuesday, 13 May 2014

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

Problem:

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

Solution:

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:
    [mysqld]
    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.

References:

Tuesday, 6 November 2012

Increase phpmyadmin import file size limit

Problem:

I'd like to increase the import file size limit for phpmyadmin.

Solution:

The import size limit of phpmyadmin is the file upload size limit of your php configuration, so the most direct method of increasing this limit is to increase the upload limit in your php.ini file.

If you have shell access with root privileges, (or high enough privileges,) you can follow these steps in the terminal to increase this limit:

  • find your php.ini file if you don't know its location, you can find it by the shell command "whereis php.ini"
  • open your php.ini file and search for the line that contains "upload_max_filesize". It may look something like "upload_max_filesize = 2M"
  • change this to the size that you need, e.g. "upload_max_filesize = 8M"
  • you may need to restart your apache server to see the change

Notes:

Note that by performing this change, the upload limit of all php scripts, not only phpmyadmin will be increased.