MySQL Import SQL script error: 2006-mysql server has gone away
To some small script that rarely complains, but recently imported a 10+m SQL script, but repeated the error:
Error occured at:2014-03-24 11:42:24 line
no.:85
Error code:2006-mysql server has gone away
Finally found the reason, the original is MySQL import mass data exceeded the default allow the largest packet so prompted 2006-mysql server has gone away
So find my.cnf, in [mysqld] add:
max_allowed_packet=300m
wait_timeout=200000
interactive_timeout = 200000
Maximum allowable packet 300M, wait timeout/activity failure often 200,000 seconds, restart MySQL
[Root@lizhong 20140323]#/etc/init.d/mysqld restart
shutting down MySQL .... Success!
Starting MySQL. success!
Re-import again, all normal!
The above mentioned is the entire content of this article, I hope you can enjoy.