# An import fails with "Server has gone away"

UrbeStack sysadmin note about MariaDB. Last updated 30 Nov 2026.

An import loses its connection when a row exceeds MariaDB's default `max_allowed_packet` limit of 16 MB. The log reports the oversized packet, and raising the limit on both the server and the client fixes the import.

## Symptoms

The import stops with this error.

```output
ERROR 2006 (HY000) at line 2: Server has gone away
```

At the same time, MariaDB logs the following warning. Check `/var/log/mariadb/mariadb.log` on AlmaLinux or run `journalctl -u mariadb` on Ubuntu.

```output
[Warning] Aborted connection 38 to db: 'example_db' user: 'example_db' host: 'localhost' (Got a packet bigger than 'max_allowed_packet' bytes)
```

## Cause

A row in the dump, often one with a large blob or a long text value, exceeds `max_allowed_packet`. The server defaults to 16 MB, or `16777216` bytes. UrbeStack leaves the value to the distribution and to you.

The server and the `mariadb` client each have their own limit. Both must accept the packet.

## Resolution

Check the server's current limit.

```
mariadb -N -e "SELECT @@global.max_allowed_packet"
```

Raise the server's limit to 64 MB immediately. This setting lasts until MariaDB restarts.

```
mariadb -e "SET GLOBAL max_allowed_packet=67108864"
```

To keep the setting after a restart, add `max_allowed_packet = 64M` under `[mysqld]` in `/etc/my.cnf.d/mariadb-server.cnf` on AlmaLinux or `/etc/mysql/mariadb.conf.d/50-server.cnf` on Ubuntu. Then restart MariaDB.

```
urbestack-service-restart --name mariadb
```

Import the dump with the client's limit set to 64 MB as well.

```
mariadb --max-allowed-packet=64M -u example_db -p example_db < dump.sql
```

If the problem persists after you follow this note, you can [open a support ticket](https://support.urbestack.com/new?type=support). Including the output of the commands you ran helps support diagnose the problem.
