---
title: Setting max_allowed_packet in MariaDB
date: 2024-09-10 08:51:49
tags: [MariaDB, MySQL, Databases]
links:
  - https://github.com/MariaDB/mariadb-docker/issues/467
---

If you need to set `max_allowed_packet` for MariaDB, you can specify it in Docker Compose as a `command`.

For example:

```yaml
services:
  mariadb:
    image: mariadb:10.9.3
    command: --max_allowed_packet=5GB
    volumes:
      - "./backend_db/mariadb.storage:/var/lib/mysql"
    ports:
      - "3306:3306"
    env_file: ./backend_db/mariadb.env
```

No Dockerfiles or configuration files needed.