Solution to "MySQL Server has gone away" error

When I was trying to import a large sql file (about 11MB) in phpMyAdmin, I got "Error 2006: MySQL server has gone away".

Solution to the above error in XAMPP is as follows:
  • In xampp\mysql\bin\my.ini file, set
    max_allowed_packet to something like 10M or 20M (larger than the sql file you are trying to import)
  • Save the file and restart Apache and MySQL servers.
That should do it. There is no need to make changes to php.ini in this case.

However, if you need to import even larger file (say 4GB), then you will need to modify both my.ini and php.ini file.

For modifying xampp\mysql\bin\my.ini, follow the steps as above to set
max_allowed_packet = 4GB.

Then modify xampp\php\php.ini, set
post_max_size = 4G
upload_max_filesize = 4G

Save the files and restart Apache and MySQL servers.

Comments

Popular posts from this blog

How to resolve 'res://ieframe.dll/acr_error.htm#' error (Internet Explorer stopped working while viewing a website)

htaccess: Redirecting multiple domains to the main domain

Removing index.php in Codeigniter using XAMPP on Windows