Changing max_allowed_packet in MySQL

max_allowed_packet is the maximum size of data that can be transferred in one request. Increase the value when the “Packet too large” error occurs so that the connection is not interrupted.
The default value for MySQL client is 16 MB, for MySQL server 64 MB.

Let’s connect to the MySQL server and see the current value:

mysql -u ixnfo.com -p
SHOW VARIABLES LIKE 'max_allowed_packet';

An example of changing max_allowed_packet to 128 MB without restarting the MySQL server:

SET GLOBAL max_allowed_packet=134217728;

If the value did not apply, and also so that it does not reset after restarting the MySQL server, add to the configuration file:

[mysqld]
max_allowed_packet=128M

And restart the MySQL server:

service mysql restart

The MySQL client has its own value, which can be changed, for example, when starting the MySQL client:

mysql --max_allowed_packet=32M

See also my articles:
Installing and configuring MySQL server on Ubuntu
My other articles

Leave a comment

Leave a Reply