MySQL error 1153: Got a packet bigger than max_allowed_packet
A statement or row is larger than max_allowed_packet allows, often a big BLOB or a huge multi-row INSERT from a dump. Raise the limit on both sides.
- Error number
1153- Name
ER_NET_PACKET_TOO_LARGE- SQLSTATE
08S01- Category
- Server limits and settings
What it means
MySQL limits the size of one protocol packet, which is roughly one statement sent or one row returned, to max_allowed_packet (64 MB by default in MySQL 8.0). The server rejects anything bigger with 1153 and usually closes the connection, so the client may report 2006 or 2013 instead.
The client has its own max_allowed_packet, which also has to be large enough.
Common causes
- Inserting large BLOB or TEXT values, such as files or images.
- Restoring a dump with very long extended
INSERTstatements. - Selecting rows with very large values through a client with a small limit.
How to fix it
-
Check the server's limit.
SHOW VARIABLES LIKE 'max_allowed_packet';
-
Raise it on the server (new connections pick it up) and persist it.
SET PERSIST max_allowed_packet = 256 * 1024 * 1024;
-
Raise it on the client too, for example
mysql --max_allowed_packet=256M, and when dumping usemysqldump --max_allowed_packet=256Mor--net-buffer-lengthto keep statements smaller.
Related errors
More server limits and settings errors
1040Too many connections1203User has more than max_user_connections1175Safe update mode blocked the statement1290Server option prevents this statement1114The table is full
The code and message text are from the MySQL 8.4 Error Message Reference. Browse the full MySQL error list or search every database error.
Work on MySQL in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for MySQL and the other databases you use.