Got a packet bigger than 'max_allowed_packet' bytes
Error 1153 (SQLSTATE 08S01) occurs when the client sends a query or data packet larger than the server's max_allowed_packet setting. This is commonly triggered by inserting large BLOB or TEXT values, or by LOAD DATA INFILE with very large rows.
- 1Inserting a BLOB or LONGTEXT column with a value larger than max_allowed_packet
- 2A single INSERT statement with many rows whose total size exceeds max_allowed_packet
- 3mysqldump --single-transaction produces a large INSERT that exceeds the destination server's limit on import
A large BLOB is inserted and exceeds the default max_allowed_packet.
-- max_allowed_packet default is 16MB in MariaDB 10.x
-- Insert a value larger than max_allowed_packet:
INSERT INTO files (data) VALUES (REPEAT('x', 20 * 1024 * 1024)); -- 20 MBexpected output
ERROR 1153 (08S01): Got a packet bigger than 'max_allowed_packet' bytes
Fix
Increase max_allowed_packet
WHEN When large BLOB values are a legitimate use case.
-- Session-level (takes effect immediately for this connection): SET GLOBAL max_allowed_packet = 64 * 1024 * 1024; -- 64 MB -- Or in my.cnf for persistence: -- [mysqld] -- max_allowed_packet = 64M
Why this works
max_allowed_packet controls the maximum size of a single client-server communication packet. Raising it allows larger individual statements. The server must be restarted for my.cnf changes to take effect; SET GLOBAL is immediate but not persistent.
✕ Set max_allowed_packet to 1G as a general practice
Very large packet sizes increase the risk of memory exhaustion on the server when many concurrent connections each send large packets.
Default max_allowed_packet is 16MB. Maximum allowed value is 1GB.
MariaDB Server error code 1153 / ER_NET_PACKET_TOO_LARGE
MariaDB max_allowed_packet ↗Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev