How to restore corrupted .IDB files on a MySQL server?

0

1

I currently have all the old .frm and .idb files from a MySQL server (actually the entire data directory). The server itself has been deleted by the user in his troubleshooting and he has installed a new server which he wants me to essentially restore all the old information to.

Currently, I have been trying to use the alter table table_name discard tablespace, alter table table_name import tablespace method to move the data to the new server, but I keep getting an error saying:

ERROR 1932 (42S02): Table 'table_name' doesn't exist in engine

If the alter table table_name import tablespace command is run again, it returns:

ERROR 1034 (HY000): Index for table 'table_name' is corrupt; try to repair it.

This has led me to try dumping the table.  However, when you run mysqldump.exe, you get:

mysqldump.exe: Couldn't execute 'show fields from table_name':
Table 'database_name.table_name' doesn't exist in engine (1932)

How can I go about recovering data from these corrupted files?

singerm0

Posted 2019-05-04T17:08:00.020

Reputation: 1

Are you using MySQL Workbench and Data Import/Restore on the old folder? – harrymc – 2019-05-04T17:48:50.757

Have you tried running the server against a copy of the backed-up data dir, using mysqldump to export it, then import the file when running the server against the real (new) data dir? – Eugen Rieck – 2019-05-04T18:13:15.460

Eugen's method has worked best so far, about 20-30% of the data was lost per table due to the corruption but this solved the issue. – singerm0 – 2019-05-04T19:34:24.173

No answers