Fix – ERROR 2006 (HY000) while importing database in MySQL

While importing big database in MySQL, you might get the error as shown below:

ERROR 2006 (HY000) at line 3387 in file: 'path_to_the_db_dump.sql': MySQL server has gone away

Step 1:

Open a terminal and find a config file for MySQL by command locate my.cnf.

You will get the list of files. Open your responsible file.

If you don’t know the responsible file then open all the files ;). There is no harm to add our solution in all the related config file.

Step 2:

Add following line to my.cnf file.


Restart your MySQL using below command.

sudo service mysql restart 
brew services restart mysql

That’s it!!!!