This means that the server timed out and closed the connection. Two most common reasons (and fixes) for the MySQL server has gone away (error 2006) are:
- Your wait_timeout variable in your MySQL my.cnf configuration file is not large enough. To fix:
vi /etc/mysql/my.cnf
, setwait_timeout = 600
seconds (you can tweak/decrease this value when error 2006 is gone), thenservice mysql restart
. - Server dropped an incorrect or too large packet. If MySQL gets a packet that is too large or incorrect, it assumes that something has gone wrong with the client and closes the connection. You can increase the maximal packet size limit by increasing the value of max_allowed_packet in my.cnf file. To fix:
vi /etc/mysql/my.cnf
, setmax_allowed_packet = 64M
(you can tweak/decrease this value when error 2006 is gone), thenservice mysql restart
.