MySQL "max_allowed_packet" error

Symptons

There are several JDBC errors in 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 enought.

Diagnosis

This error appears several times in application log.

Solution

In order to increase the packet size you have to modify the max_allowed_packet parameter. Edit /etc/my.cnf for MySQL instance, or /etc/my.cnf.d/server.cnf for MariaDB (in some distros
you my 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 by this query:

select @@max_allowed_packet

Properties

Properties

Date

2017-02-14

Applies to

  • Core

Keywords

  • AllVersions
  •