9

A very important database has gone corrupt that was sitting on server at a shared web host, and I didn't back up. The table contains a large list of very important email addresses. I can get a table listing, but if I open any of the tables with Navicat or phpMyAdmin, I get the following error:

Incorrect information in file: './the-table-name.frm'

I was able to get a hold of the .frm files associated with the database from the web host.

There is other data in there, but if I could at least get the email addresses, I would be alright.

How do I recover this database? I would be willing to pay somebody to fix this.

hobodave
  • 28,925
  • 4
  • 72
  • 77
Paul Gordon
  • 2,532
  • 3
  • 26
  • 24

2 Answers2

17

This belongs on serverfault.

First, .FRM files contain none of your "data". They are simply the definition of the table.

If all of the following are true:

  • The table is using the MyISAM storage engine
  • You know the CREATE TABLE statement required to recreate the table

Then, do the following:

  1. Stop MySQL
  2. Backup your table_name.frm, table_name.MYI, table_name.MYD files
  3. Delete them from your mysql data directory (/var/lib/mysql usually)
  4. Start MySQL
  5. CREATE the table again
  6. Stop MySQL
  7. Copy the .MYD and .MYI files back into the datadir, replacing the ones there.
  8. Start MySQL
  9. ???
  10. Profit
hobodave
  • 28,925
  • 4
  • 72
  • 77
  • Thanks...but does that mean if I'm on InnoDB, I'm screwed? – Paul Gordon Feb 23 '10 at 16:23
  • Well, InnoDB is "crash safe" and much more resilient than MyISAM. A .frm file cannot become corrupted through normal mysql usage. Without knowing what you did I cannot help you. Regardless, it's beyond the scope of SO, as it's not programming related. – hobodave Feb 23 '10 at 16:41
  • it doesnt work for me, still corrupted table – piggyback Dec 05 '13 at 00:19
  • i dont remember my table structrue. Is that any way to recreate the table ? – Siraj Alam Feb 23 '17 at 17:33
0

I had a similar issue, it turns out the MySQL InnoDB engine was turned off (I was able to check via phpMyAdmin, a bash pro could tell you how to do it other ways). in my case, it was a simple as restarting MySQL, but you may want to check your config if something changed there.

Addo Solutions
  • 1,619
  • 3
  • 20
  • 37