How can I fix the error: Mysql Server has gone away?

When looking at the mail log of the server you see this log entry from Amavis:

Aug  3 01:00:20 el7p17 amavis[114160]: (114160-02) NOTICE: reconnecting in response to: err=2006, HY000, DBD::mysql::st execute failed: MySQL server has gone away at (eval 130) line 173.

Amavis tries to use a persistent connection to mariadb but the server has dropped the mariadb connection so Amavis has to try again to re-establish the connection.

How to Fix:

Check that wait_timeout mysql variable in your /etc/my.cnf configuration file is large enough (don't forget to also check for the value in your /etc/my.cnf.d/ directory overriding the default). It is recommended that you set the variable to its default value within the [mysqld] section:

[mysqld]
wait_timeout = 28800

Restart MariaDB:

systemctl restart mariadb

Once you’ve made these changes, and restarted your MariaDB server, the issue should be fixed.

  • mysql
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How can I fix any statistics generation problems?

Missing the Warden Crontab Entry There is a crontab entry that will update Warden statistics...

How can I fix the error: "milter-reject: END-OF-MESSAGE from..." in the log and found the AV in error (cannot read /etc/clam.d/scan.conf).

Cloudlinux / Imunify360 added their own version of ClamAV to their repo which accidentally...

How can I fix the error: Can't connect to TCP port 10024 on 127.0.0.0 [Address already in use] when trying to start Amavis?

When trying to start Amavis you see this in the mail log: Oct 02 03:20:15 condor3648 systemd[1]:...

How can I fix the error: Can't connect to TCP port 10024 on ::1 [Cannot assign requested address] when trying to start Amavis?

When trying to start Amavis you see this in the mail log: Oct 02 03:20:15 condor3648 systemd[1]:...

How can I fix the error: Error [Contentfilter_Settings_Contentfilter]. Message [[QUARANTINEDIR] must be a valid directory?

This error means that Amavis was not installed correctly. Try running the Warden from the command...