Thursday, February 7, 2013

ERROR 2006 (HY000): MySQL server has gone away

Issue:


mysql -u root -proot123 mydb < /root/db-2013-01-30.sql
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...

Analysis:-

Actually dump file having large INSERT queries, and also “max_allowed_packet” size was set to very low value.

So, when the mysql client or the mysqld server receives a packet,which is bigger than max_allowed_packet bytes, it will throw error and close the connection.

Solution:-

In /etc/my.cnf , I updated the entry
max_allowed_packet=1M
to
max_allowed_packet=64M

now run the query for restore again:-
mysql -u root -proot123 mydb < /root/db-2013-01-30.sql

It worked!!

No comments:

Post a Comment