Problem:
You are trying to run a MariaDB container using docker-compose
. However, the database container doesn’t start up and you see error messages like these in the logs:
[ERROR] mysqld: Aria recovery failed. Please run aria_chk -r on all Aria tables and delete all aria_log.######## files [ERROR] Plugin 'Aria' init function returned error. [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed. .... [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded [ERROR] Failed to initialize plugins. [ERROR] Aborting
Solution:
The log messages already tell you what to do – but they don’t tell you how to do it:
Aria recovery failed. Please run aria_chk -r on all Aria tables and delete all aria_log.######## files
First, backup the entire MariaDB data directory: Check onto which host directory the data directory (/var/lib/mysql
) of the container is mapped and copy the entire directory to a backup space. This is important in case the repair process fails.
Now let’s run aria_chk -r
to check and repair MySQL table files.
docker-compose run my-db bash -c 'aria_chk -r /var/lib/mysql/**/*'
Replace my-db
by the name of your database container. This will attempt to repair a lot of non-table-files as well but aria_chk
will happily ignore those.
Now we can delete the log files:
docker-compose run my-db bash -c 'rm /var/lib/mysql/aria_log.*'
Again, replace my-db
by the name of your database container.