How to fix “#2006 – MySQL server has gone away”

Generally when we are importing the large database “sql” format file into phpmyadmin then it gets an error “mysql server has gone away”. So we have checked out why it’s getting and how to fix it.

Why is there a “mysql server has gone away” error?

It’s getting an error when we are importing the database and the database size is larger compared to maximum size limits. In simple words mysql server gets a packet that is larger than the “max_allowed_packet”. It’s a “Packet too large” or “mysql server has gone away” error.

How to fix it?

We know about how it’s getting errors. According to our previous  discussion if we modified the “max_allowed_packet” then we would fix it. So modifying the “max_allowed_packet”, we have to go to the “C:\xampp\mysql\bin” location and then find the “my.ini” file and open it in the editor mode. And then search “max_allowed_packet” and update the value into 100M and save it and reboot the xampp server.

default value is 1mb and after updating its 100mb

After rebooting the xampp server, Now server is able to allowed more packets to execute the data. Now server is ready to importing the large database file.

So, first of all just drop out all the database tables and try one more time to import the database file and wait until it’s complete, after taking some time it’s completed.

Leave a Reply

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

You May Also Like