Monday, 10 July 2023

MySQL error - Packet for query is too large (4,739,923 > 65,535). You can change this value on the server by setting the 'max_allowed_packet' variable'

 Souce - MySQL doc -> A communication packet is a single SQL statement sent to the MySQL server, a single row that is sent to the client, or a binary log event sent from a replication source server to a replica.

The largest possible packet that can be transmitted to or from a MySQL 8.0 server or client is 1GB.

When MySQL server or client receives packet bigger than default max_allowed_packet size then throw the exceptionPacket for query is too large (4,739,923 > 65,535). You can change this value on the server by setting the 'max_allowed_packet' variable

For the above issue, the exception itslef suggests to change the max_allowed_packet size. If you are using or writing/executing query from command prompt then use below query to set or increase the max_allowed_packet.

mysqld> SET GLOBAL max_allowed_packet=128M

Or even set 512M 

If you are using MYSQL workbench then directly execute above query.

Default server max_allowed_packet size is 65M.

To check the existing max_allowed_packet size then use below query,

--> show variables like 'max_allowed_packet'.


Thank you for reading the post.

No comments:

Post a Comment