1153ERRORTier 2 — Caution✅ HIGH confidence

Got a packet bigger than 'max_allowed_packet' bytes

Category: Resource LimitVersions: All MariaDB / MySQL versions

What this means

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.

Why it happens

  1. 1Inserting a BLOB or LONGTEXT column with a value larger than max_allowed_packet
  2. 2A single INSERT statement with many rows whose total size exceeds max_allowed_packet
  3. 3mysqldump --single-transaction produces a large INSERT that exceeds the destination server's limit on import

How to reproduce

A large BLOB is inserted and exceeds the default max_allowed_packet.

trigger — this will ERROR
-- 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 MB
ERROR 1153 (08S01): Got a packet bigger than 'max_allowed_packet' bytes

Fix 1: Increase max_allowed_packet

When large BLOB values are a legitimate use case.

fix
-- 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.

What not to do

Set max_allowed_packet to 1G as a general practice

Why it's wrong: Very large packet sizes increase the risk of memory exhaustion on the server when many concurrent connections each send large packets.

Version notes

MariaDB 10.2+Default max_allowed_packet is 16MB. Maximum allowed value is 1GB.

Sources

📚 Official docs: https://mariadb.com/kb/en/server-system-variables/#max_allowed_packet

🔧 Source ref: MariaDB Server error code 1153 / ER_NET_PACKET_TOO_LARGE

📖 Further reading: MariaDB max_allowed_packet

Confidence assessment

✅ HIGH confidence

Stable and well-documented.

See also

📄 Reference pages

max_allowed_packetBLOB storage
⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →