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

siva636 picture siva636 · Sep 13, 2011 · Viewed 13.7k times · Source

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.

Answer

siva636 picture siva636 · Sep 21, 2011

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)