Inconsistent database (mariadb)

Hi Folks,

I’m using nextcloud in a docker setup.
Before some days I was extracting some archives on my server. The same time I used nextcloud to sync stuff.
That caused a inconsistent database state.
Now my mariadb doesn’t want to start.
The solution seems to start the database in a recovery mode. Then I need to dump the database, reinstall it and write the dump back.

Now my question: Is there a easier way? I have no idea how to do the above in a docker container…


a backup command would look like this:

sudo docker exec db mysqldump --single-transaction -h localhost -u {{ nextcloud_db_user }} -p{{ nextcloud_db_passwd }} {{ nextcloud_db_name }}

you have to change “{{ … }}” with your values.

to execute a mysql command inside the docker container simply put a
sudo docker exec <container-name/id>
in front of the mysql command.

you could also do a sudo docker exec -it db /bin/sh to get an interactive shell. put only if the container is running. if it stops because of corrupted database that won’t work.

to fix your database you should ask google. i’m sure someone had already the same problem.


Okay thank you.
I decided to reinstall my whole nextcloud setup ^^