My database won’t start after restarting the server.
it throws the following error;
[ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
So my question is how do I start innodb in recovery mode using docker?
2
Answers
To start innodb in recovery mode, you need to add the following line to the
my.cnf
file:0 is normal use. You can read more about the different levels here:
https://mariadb.com/kb/en/innodb-recovery-modes/
Usually, the recommendation is to start from the lowest possible value (e.g. try 1), and if that doesn’t work, then increment up. Possible data corruption may occur the higher level you use.
If you already have the
my.cnf
file mapping between your host and the container, then just make the modification on your host and start the Docker service.If you don’t have the
my.cnf
file, then you probably have the default variables defined. One of the easiest options is to:/tmp
folder to your local machine/path-on-host/tmp
.docker exec -it container_name bash
) and copy the my.cnf file to the tmp folder (cp /etc/my.cnf /tmp
) and shut down the container. The location of themy.cnf
file is either in/etc
, or on some versions it can be in/etc/mysql
.my.cnf
file on your host machine by setting theinnodb_force_recovery = x
my.cnf
to the correct location on your original container, e.g. using Docker Compose:or when using
docker run
Yo can add it in the ‘command’ line (temporally!) like any other init arguments
https://mariadb.com/kb/en/innodb-recovery-modes/#recovery-modes