Updated: 28 September 2026 · Applies to: MariaDB 10.6 to 11.4 and MySQL 8

max_allowed_packet is the largest single query or row MySQL/MariaDB accepts. Imports of big rows (for example images stored in the database) fail with "MySQL server has gone away" or "Packet too large" when it is too small.

Change it (VPS or dedicated server)

  1. Edit the server configuration, /etc/my.cnf (or a file in /etc/mysql/ on Ubuntu and Debian), and set the value in the [mysqld] section:
    [mysqld]
    max_allowed_packet=256M
  2. Restart the database server: /usr/local/cpanel/scripts/restartsrv_mysql on cPanel, or systemctl restart mariadb.
  3. Check it: mysql -e "SHOW VARIABLES LIKE 'max_allowed_packet';"

The mysql command-line client has its own limit; for a large import use mysql --max_allowed_packet=256M dbname < dump.sql.

Note: On shared hosting the server setting cannot be changed per account. If an import fails, ask support to import the file for you.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Managed cPanel VPS

cPanel included; we handle updates, security and monitoring.

Server management

on-demand administration, hardening, migrations and monitoring.

Was this answer helpful?

Still stuck? Open a ticket