Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ganapathichidambaram/fc9b0397e28f4b29703cb887b2951ad3 to your computer and use it in GitHub Desktop.
Save ganapathichidambaram/fc9b0397e28f4b29703cb887b2951ad3 to your computer and use it in GitHub Desktop.
Steps to Recover MariaDB InnoDB corrupted table

Steps to Recover InnoDB Tables

  1. Stop mysqld.

  2. Backup /var/lib/mysql/ib* files for safety reason.

  3. Add the following line into /etc/my.cnf:

    innodb_force_recovery = 1
    
  4. Restart mysqld and check service started or not. In-case service not started then change the innodb_force_recovery value to 4 then try to restart mysqld service again.

  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 or remove innodb_force_recovery = 4 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment