Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring MySQL server to avoid "MySQL Server has gone away" error

When I tried to establish a MySQL database using a dump, I got the following error message

ERROR 2006 (HY000) at line 312: MySQL server has gone away

After extensive Googling (and searching in this forum), I found that I have to increase the max_allowed_packet in the my.ini file. I have tried various values (including very large values) for this parameter, but I cannot get rid of this error.

Even if I specify the --max_allowed-packet option in the command line (as follows) there is no use

C:\Users\Panora>mysql --user=root --password=root --max-allowed-packet=600M db < dump.sql
ERROR 2006 (HY000) at line 50973: MySQL server has gone away

I tried creating the dump file using the following command, still no use

mysqldump --opt --skip-extended-insert --max_allowed_packet=10M --user=root --password=root db > dump.sql

Please advice me what I am really missing.

like image 702
siva636 Avatar asked Sep 13 '11 06:09

siva636


People also ask

What causes MySQL server has gone away?

The most common reason for the MySQL server has gone away error is that the server timed out and closed the connection. In this case, you normally get one of the following error codes (which one you get is operating system-dependent). The client couldn't send a question to the server.

Can't connect to MySQL server timed out?

A Connection Timed Out error occurs when the database's firewall won't allow you to connect to the database from your local machine or resource. If you are getting this error, check that you have added the machine or resource you are connecting from to the database's list of trusted sources.


1 Answers

After extensive analysis, I have found that the old technique simply works, yes, editing the my.ini configuration file.

But the actual problem is to locate the my.ini file (MySQL V5.5 on Windows Vista), which is in the following location and this folder is HIDDEN (not like earlier versions) by default:

C:\ProgramData\MySQL\MySQL Server 5.5\my.ini

(Note the name carefully, this is NOT Program Files but ProgramData)

like image 137
siva636 Avatar answered Sep 23 '22 02:09

siva636