MySQL "max_allowed_packet" error

Symptoms

There are several JDBC errors in the log:

Packet for query is too large (1728595 > 1048576). You can change this value on the server by setting the max_allowed_packet.

Cause

As the message says, the max_allowed_packet setting is not big enough.

Diagnosis

This error appears several times in the application log.

Solution

In order to increase the packet size you have to modify the max_allowed_packet parameter. Edit /etc/my.cnf for a MySQL instance, or /etc/my.cnf.d/server.cnf for MariaDB (in some distros
you may find it at /etc/mysql/mariadb.conf.d/50-server.cnf)

[mysqld]
max_allowed_packet=256M

Once changed, you need to restart MySQL. On Debian/Ubuntu, the command is:

/etc/init.d/mysql restart

And on Fedora/RedHat/CentOS, it is:

/etc/init.d/mysqld restart

After that you can check this new value with this query:

select @@max_allowed_packet

Properties

Properties

Date

2017-02-14

Applies to

  • Core

Keywords

  • AllVersions
  •