MySQL: ERROR 1153 (08S01): Got a packet bigger than ‘max_allowed_packet’ bytes

MySQL: ERROR 1153 (08S01): Got a packet bigger than ‘max_allowed_packet’ bytes

Error: MySQL: ERROR 1153 (08S01): Got a packet bigger than ‘max_allowed_packet’ bytes indicates that the “max_allowed_packet” size is reached on the server. This usually occurs during importing of huge files.

First, check the current limit on your server:

$ mysql -uroot
mysql> SELECT @@max_allowed_packet / 1024 / 1024;

+————————————+
| @@max_allowed_packet / 1024 / 1024 |
+————————————+
| 16.00000000 |
+————————————+
1 row in set (0.01 sec)

In my case, the limit is 16MB.

To increase the limit use:

$ mysql -uroot
mysql> SET GLOBAL net_buffer_length=1000000;
mysql> SET GLOBAL max_allowed_packet=1000000000;

This will increase the max allowed packet size to 1000000000, or 100MB.

To permanently increase the packet size edit the my.cnf file:

nano /etc/my.cnf

Find and edit (or create) a line:

max_allowed_packet      = 100M

Save the file and restart the mysqld service.

service mysqld restart

Source. MySQL 8.0 Reference Manual 

whoami
Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.