Thursday, July 27, 2017

Fix MySQL InnoDB tablespace exists (corrupt tablespace issue)

Mainly this tablespace error happen when file missing from mysql data folder.
You'll find an orphaned tablename.ibd file without it's normal companion tablename.frm file. If you move that .ibd file to a safe temporary location (just to be safe) that should fix the problem.

Example inside  mysql/data/database_name  folder you'll find this kind of list.
table1.frm
table1.idb
table2.frm
table2.ibd
table3.idb <- problem table, no table3.frm
table4.frm
table4.idb

Here is the solution steps:
  1. backup your database first.
  2. stop mysql engine service
  3. remove the database directory manually from inside mysql/data/database_name.
  4. start mysql engine
  5. create new database with any name different from your corrupted database/ or same name as you want.
  6. Import the backed up database now. 
After restoring your backup and your table will be working fine.

No comments:

Post a Comment

Total Pageviews