The ‘MySQL server has gone away’ error is a bit intimidating, making you feel that the server is removed. However, that is not the case and the solution to this problem is pretty simple. The main causes of this error are:

  1. Server timed out and closed the connection. (As the transaction is taking too long)
  2. Server dropped a too large packet.

This error indicates that the MySQL Server is closing the connection to perform the current task. This error normally occurs when the timeout value is being set too low. By changing the below two values, this can be solved.

  1. wait_timeout – Time in seconds the server waits for a connection to become active before closing it.
  2. max_allowed_packet – Maximum size in bytes of a packet or a generated string.

Example

wait_timeout = 28800   – (wait for 8hours)

max_allowed_packet = 128M   – (or further to 256M or 1024M)

These values can be changed in the MySQL configuration file at /etc/my.cnf file. After this change restart MySQL using the below command.

sudo /etc/init.d/mysql restart

This should fix the ‘MySQL server has gone away error’. If you still face the issue, please have your server administrator check this further.

If you want all your KPI‘s or Business metrics monitored on a single dashboard, join our BETA.

By Liz Mathew

Founder, InsightDials

error: Content is protected !!