Monthly Archives: April 2021

Inoddb recovery from crash

We had a Inoddb database crash in server , Where Mysqld was not starting.

So first we checked on what databases tables are crashed or corrupted using

command mysqlcheck -A –all-databases and repaired it using

mysqlcheck --auto-repair –all-databases

You can check in below URL for additional functions using mysqlcheck

https://mariadb.com/kb/en/mysqlcheck/

First thing we did was got mysql in recovery mode using innodb_force

As with 0,1,2 mysql was not coming up we used value 3 to get innodb online in read only mode.

innodb_force_recovery = 3

now as mysql was online we made a full dump of mysql which include all databases

mysqldump –all-databases > all_databases.sql

Once complete dump was ready

We stopped the Mysql services using below command

whmapi1 configureservice service=mysql enabled=1 monitored=0

,We moved the the

mv /var/lib/mysql /var/lib/bkp_mysql

/scripts/restartsrv_mysql –stop

We now reinitialized the mysql using below command

mysqld –initialize –user=mysql

Now we restored the dump which we had created using command

Mysql Mysql < all_databases.sql

After the dump was restored , The mysql was restarted

/scripts/restartsrv_mysql –start

whmapi1 configureservice service=mysql enabled=1 monitored=1

Mysql root password was reset using below command

/scripts/mysqlconnectioncheck