2

One of my databases got corrupted. All of the tables are stored using MyISAM engine. I managed to grab what's left in the server's mysql\data folder. All the ib* files are intact.

As for the tables, for those that have .frm, .MYD and .MYI files, I can dump them. I used innodb_force_recovery in order to start the database before dumping them into .sql files.

However there are tables that are missing .MYD and .MYI files, so only .frm files are left. As I understand it, for tables created using MyISAM engine, .MYD contains the table's data. Is there any way to recover data from these tables or is it impossible to do?

2
  • 2
    Yes, the .MYD is the only place data for a MyISAM table is stored. Are you sure it was MyISAM? What other evidence (SHOW TABLE STATUS, error messages, etc)?
    – Rick James
    May 26 at 3:18
  • 1
    flagged for movement to dba, please do the same and do not delete the question so it will be linked. if you deleted it restore from backup
    – djdomi
    May 26 at 4:53

1 Answer 1

0

You can't restore data from the .frm files. That file only contains the table metadata — i.e. column names and types, and so on. No data.

The .MYD contained the data. The .MYI contained the indexes on that data. Indexes can be rebuilt from data, but the data cannot be reconstructed from the table definition alone.

If you had a recent backup of your database, that's the only place you will get the data from.

If you don't have a backup, then you're out of luck. The only thing you have is a costly lesson in the importance of making backups.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.