MySQL Server has gone away when importing large sql file

Before anything else, make sure you have set the upload_max_filesize value in your php.ini config file to allow importing large sql file.

If you need tutorial follow my previous post here.

Lets solve the error: #2006 MySQL Server has gone away when importing large sql file.

There are two common reasons caused either by the maximum allowed packet size ot InnoDB log file is too small.

In my case both of them, so we might need to resize the value, follow below:

1. If you still running your MySQL, shut it down.

2. Now edit my.conf in /etc/msql/my.conf (if you’re using xampp local server /mysql/bin/my.ini)

3. Find max_allowed_packet update value to 64MB

4. Find innodb_log_file_size update value to 256MB

5. Now Start MySQL

Note: If the error still show, repeat the instructions and increasing both values.

Leave a Reply

Your email address will not be published. Required fields are marked *