Add the following line to your mysql configuration
/etc/my.cnf
innodb_force_recovery = 6
Then stop the service and run mysqld_safe without the user database
systemctl stop mariadb.service mysqld_safe --skip-grant-tables &
Now dump the databases
(Now I'm using da_admin
here, but as standard you would use root
)
mysqldump -u da_admin --opt --all-databases > alldb.sql
Once the databases have been dumped remove the >force_recovery
, restart the database
systemctl restart mariadb.service
Now drop the databases and reimport the databases from the dump
(Please test the database import on another database before you drop your tables)
mysql -u da_admin -p-f < alldb.sql
Hopefully your database server will have a new lease of life!