Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Fix "Got a packet bigger than 'max_allowed_packet' bytes"

This MySQL error appears when you import or save a very large piece of data. This guide shows how to raise the limit.

Web Hosting2 min read10 steps

What does it mean?

MySQL is a program that stores the data of your website in a database. A database is like a big digital filing cabinet. MySQL receives data in small bundles called packets. The setting max_allowed_packet is the largest bundle it will accept. If a bundle is bigger, you see the error.

It often happens when you import a big database file or save a large post with images inside.

Option 1: Change it for now (needs root or admin rights)

This guide needs access to a MySQL account that has admin rights. This is normal on a VPS or dedicated server. On shared hosting you cannot do this. Use Option 3 instead.

  1. Connect to your server with SSH.
  2. Log in to MySQL:
mysql -u root -p

This opens the MySQL command line and asks for the password.

  1. Set a larger value. This example uses 64 MB:
SET GLOBAL max_allowed_packet=67108864;

This raises the limit until MySQL restarts.

  1. Check the value:
SHOW VARIABLES LIKE 'max_allowed_packet';

This prints the current limit.

Option 2: Make the change permanent

  1. Back up your config file first.
  2. Open the MySQL config file. It is often /etc/my.cnf or /etc/mysql/my.cnf.
  3. Find the [mysqld] section.
  4. Add this line:
max_allowed_packet=64M
  1. Save the file.
  2. Restart MySQL. On many systems the command is:
systemctl restart mysqld

On some systems the service is called mysql instead.

Warning: A bad config file can stop MySQL from starting. Keep your backup copy so you can put it back.

Option 3: Shared hosting

You cannot edit server settings on shared hosting. Try these instead:

  • Split a big import file into smaller parts.
  • Export your database again with the option for smaller inserts.
  • Ask Hostvento support to raise the limit. Open a support ticket.

Quick recap

  • The error means one bundle of data is larger than MySQL allows.
  • Raise max_allowed_packet with SET GLOBAL or in the config file.
  • Restart MySQL after editing the file.
  • On shared hosting, split the file or ask support.