buy tb500

Archive for July, 2015

Repair innodb corruption on cPanel mysql Server

Wednesday, July 8th, 2015

1. Stop mysqld.
2. Backup /var/lib/mysql/ib*
3. Add the following line into /etc/my.cnf

innodb_force_recovery = 4

4. Restart mysqld.
5. Dump all tables:# mysqldump -A > dump.sql
6. Drop all databases which need recovery.
7. Stop mysqld.
8. Remove /var/lib/mysql/ib*
9. Comment out innodb_force_recovery in /etc/my.cnf
10. Restart mysqld. Look at mysql error log. By default it should be /var/lib/mysql/server/hostname.com.err to see how it creates new ib* files.
11. Restore databases from the dump:mysql < dump.sql

You can also run /scripts/mysqlup –force after step 8. as this will recreate the ibdata files. This is also unsupported and caution should be taken to not lose any vital customer data in the databases.

 

References

http://webscholar.net/2010/11/07/repair-innodb-corruption-on-cpanel-mysql-server/