Recovery form MySQL corruption¶
Background¶
There are two instances of MySQL on Cloudron. One instance runs on the host and is used by the platform. Another instance is the
MySQL addon which runs in a container named mysql and is shared by apps. You can use the steps below to recover the host MySQL.
Danger
Always make sure to take a backup/snapshot of the server before proceeding
Soft recovery¶
If MySQL is running and you can connect to it using mysql -uroot -ppassword (sic), then maybe the data is already salvagable.
Try to create a dump of existing data:
| bash | |
|---|---|
If one or more steps above get "stuck", it means MySQL database is corrupt. Follow the hard recovery steps below.
Hard Recovery¶
- Stop box code:
- Create a backup of the MySQL data with:
- Edit
/etc/mysql/my.cnfto have the below. See the recovery docs for details. - Keep increasing the above value till MySQL starts with:
- Once it starts, we have to take a dump of the database:
- Now that we created the dump, stop MySQL:
- Remove the
innodb_force_recoveryin/etc/mysql/my.cnf - Recreate the existing MySQL installation:
- Start MySQL:
- Change the root password to
password(sic) - - Import the database:
- Start the platform code again: