How to fix Docker MariaDB not starting up "upgrade ... required but skipped due to $MARIADB_AUTO_UPGRADE"

Problem:

Your MariaDB / MySQL container doesnt start up due to

mariadb_1    | 2024-05-27 03:03:20+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.3.2+maria~ubu2204 started.
mariadb_1    | 2024-05-27 03:03:20+00:00 [Warn] [Entrypoint]: /sys/fs/cgroup///memory.pressure not writable, functionality unavailable to MariaDB
mariadb_1    | 2024-05-27 03:03:20+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
mariadb_1    | 2024-05-27 03:03:20+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.3.2+maria~ubu2204 started.
mariadb_1    | 2024-05-27 03:03:21+00:00 [Note] [Entrypoint]: MariaDB upgrade information missing, assuming required
mariadb_1    | 2024-05-27 03:03:21+00:00 [Note] [Entrypoint]: MariaDB upgrade (mariadb-upgrade or creating healthcheck users) required, but skipped due to $MARIADB_AUTO_UPGRADE setting
mariadb_1    | 2024-05-27  3:03:21 0 [Warning] Could not increase number of max_open_files to more than 1024 (request: 32186)
mariadb_1    | 2024-05-27  3:03:21 0 [Warning] Changed limits: max_open_files: 1024  max_connections: 151 (was 151)  table_cache: 421 (was 2000)

Solution

Add

- MARIADB_AUTO_UPGRADE=1

to the environments section of your docker-compose.yml.

Then, restart the container. MariaDB will then auto-upgrade itself.