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 开发者_如何学Gofound 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.
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)
If you are not in linux, as I assume by: "C:\Users\Panora", you need to review your mysql.ini configuration. Did u think about the amount of memory to do a big dump? And did u try with the time-out of the operation?
And please review the configuration of the mysql service on windows, using start/run/ services.msc
精彩评论