mysqldude
Error codes › 1153

MySQL & MariaDB error 1153: Got a packet bigger than 'max_allowed_packet' bytes

Error messageGot a packet bigger than 'max_allowed_packet' bytes
Example from our test runs: Got a packet bigger than 'max_allowed_packet' bytes (8.0.46)

A single statement, row or value sent to (or from) the server exceeds max_allowed_packet. MySQL 8.0+ clients report it as 1153; MySQL 5.x and MariaDB clients usually just see "server has gone away" (2006).

MySQLMariaDB
SymbolER_NET_PACKET_TOO_LARGEER_NET_PACKET_TOO_LARGE
SQLSTATE08S0108S01
TypeServer errorServer error
Versionsevery release since 5.0 activeevery release since 5.5 active

What it means

Every statement and every row in a result travels as one packet, which can’t exceed max_allowed_packet (default 4 MB on MySQL 5.6/5.7, 64 MB on MySQL 8.0+, 16 MB on MariaDB). When a client sends more, the server closes the connection. In our tests, MySQL 8.0, 8.4 and 9.x clients show 1153, while MySQL 5.6/5.7 and MariaDB clients show only 2006, which is why so many “server has gone away” searches are really this problem.

Why it happens

  • Large BLOB / LONGTEXT values: images, PDFs, JSON documents.
  • Very long multi-row INSERTs, as produced by mysqldump from a server with a bigger limit.
  • GROUP_CONCAT or REPEAT results above the limit (those return NULL with warning 1301 instead).

How to fix it

  • Raise it on the server: SET GLOBAL max_allowed_packet = 67108864; and in my.cnf ([mysqld] max_allowed_packet=64M). New connections pick it up.
  • Raise it on the client too: mysql --max-allowed-packet=64M, mysqldump --max-allowed-packet=…, or the driver option.
  • For dumps from another server, match its value, or dump with --net-buffer-length so INSERTs are split.
  • Store very large files outside the database and keep a path or URL in the row.

Reproduce it yourself

These steps are the exact test our harness runs. Use a scratch server, never production.

  1. Connect with mysql -u root -p and create a scratch database and the test data:

    CREATE DATABASE demo;
    USE demo;
    CREATE TABLE big (b LONGBLOB);
  2. As an admin, lower the limit to 1 MB (new connections pick it up).

    SET GLOBAL max_allowed_packet = 1048576;
  3. Reconnect and send a statement of about 3 MB, for example from a shell:

    { printf "INSERT INTO big VALUES ('"; head -c 3000000 /dev/zero | tr '\0' a; printf "');\n"; } | mysql -u root -p demo
  4. Put the limit back afterwards (64 MB is the MySQL 8.0 default).

    SET GLOBAL max_allowed_packet = 67108864;

You get: ERROR 1153 (08S01) at line 1: Got a packet bigger than 'max_allowed_packet' bytes(9.7.4)

Verified fixes

  1. Raise max_allowed_packet on the server (and the client)

    Raise the server limit (and put it in my.cnf under [mysqld] so it survives a restart).

    SET GLOBAL max_allowed_packet = 67108864;  -- 64 MB

    Reconnect with a matching client limit and send the statement again.

    mysql -u root -p --max-allowed-packet=64M demo < big-insert.sql

Tested on

StepMySQLMariaDB
5.65.78.08.4910.610.1111.411.8
Insert a 3 MB value while max_allowed_packet is 1 MB
repro
✓ 2006✓ 2006✓ 1153✓ 1153✓ 1153✓ 2006✓ 2006✓ 2006✓ 2006
Raise max_allowed_packet on the server (and the client)
fix
✓✓✓✓✓✓✓✓✓
Insert a 3 MB value while max_allowed_packet is 1 MB repro
MySQL 5.6✓ 20065.7✓ 20068.0✓ 11538.4✓ 11539✓ 1153
MariaDB 10.6✓ 200610.11✓ 200611.4✓ 200611.8✓ 2006
Raise max_allowed_packet on the server (and the client) fix
MySQL 5.6✓5.7✓8.0✓8.4✓9✓
MariaDB 10.6✓10.11✓11.4✓11.8✓
✓works ✓ 1062fails with the error the step demonstrates ⚠works with a warning ≠runs, result differs ✗fails Tested 2026-11-25 on 5.6.51, 5.7.44, 8.0.46, 8.4.13, 9.7.4, 10.6.28, 10.11.19, 11.4.13, 11.8.9

Related errors

  • 2006 CR_SERVER_GONE_ERRORexplained
  • 2013 CR_SERVER_LOSTexplained
  • 1301 ER_WARN_ALLOWED_PACKET_OVERFLOWED