Recover MySQL Accounts when innodb gets corrupted

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!

Author: Andrew

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.