Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

What I have learned from Google searching:

With MyISAM tables you can simply copy the FRM, MYD, and MYI files. In the folder for the DB I'm trying to recover, there are only FRM files and a "db.opt" file, so they must not be MyISAM tables.

Situation:

My computer crashed, but the data is still on the hard drive. The MySQL 5.5.8 server was installed with WAMP on the crashed computer.

I have tried copying the entire data folder over, but MySQL only creates a blank database - no tables.

There is an FRM file for each of the tables I wish to recover. However, they are not readable text files. Is there any way to recover the table structure from these files?

This post http://stackoverflow.com/a/7688688/1188138 indicates that the structure is in fact in those files, but does not provide a method of retrieval.

Thank you so much - I have tried everything I can think of.

share|improve this question

migrated from stackoverflow.com Feb 3 '12 at 19:56

This question came from our site for professional and enthusiast programmers.

    
Is the location of the files on the new server the same as the old one? –  Karlson Feb 3 '12 at 18:50
    
Yes - the relative path is data/[name of database] on both servers. I only copied the [name of database] folder (which contains the FRM files and the OPT file). No other files were copied. –  Steve Burke Feb 3 '12 at 19:54
add comment

3 Answers

up vote 4 down vote accepted

If you only see the .frm files, then there is a strong likelihood that the storage engine in use was InnoDB and innodb_file_per_table must have been off by default.

If you transferred everything from datadir on the crashed server onto another disk on another machine, you may be able to startup mysql with that folder as is.

For example, suppose ServerA is your crashed server and ServerB is where you want it placed.

  • Install MySQL 5.5.8 on ServerB
  • net stop mysql on ServerB to make sure mysql is down on ServerB
  • md C:\MySQLData on ServerB
  • Drop everything from the data folder on ServerA into C:\MySQLData on ServerB
  • Make C:\MySQLData the new datadir

Add this to my.ini on ServerB

[mysql]
datadir=C:/MySQLData
  • C:\> del C:\MySQLData\ib_logfile* on ServerB
  • net start mysql on ServerB

Please try this and tell us what happened

UPDATE 2012-02-03 17:06 EDT

Since you were able to recover everything NOW DO THIS:

mysqldump -u... -p... -A -d --routines --triggers > C:\MySQLSchema.sql

This will give all table structures in the MySQL Instance.

share|improve this answer
    
This worked. I did a slightly different method where I renamed the current data folder to data2, then copied the old data folder over. Although I didn't need the data, it's worth noting that this method recovers the data as well. Thank you all! –  Steve Burke Feb 3 '12 at 21:57
add comment

If you copied the files to the new location, it is likely you copied the files with your user's permissions.

MySQL will need permission to read/write to the data directory.

share|improve this answer
    
The question mentions WAMP so this is a "MySQL for Windows" topic. Although the answer is short, your answer is more of a Linux environment suggestion which is common problem (not to say file permissions doesn't affect Windows as well). When I recently answered this question, dba.stackexchange.com/a/44316/877, I remembered your answer along the lines of file permissions. From this perspective, you get a +1 !!! –  RolandoMySQLDBA Jun 12 '13 at 15:05
add comment

Use the new FRM Reader utility

http://drcharlesbell.blogspot.com/2013/04/mysql-utilities-new-frm-reader-utility.html

http://mysqlblog.fivefarmers.com/2013/04/09/mysql-utilities-meets-the-worlds-ugliest-table/

share|improve this answer
1  
Please add some more info about the utility besides the links. Link-only answers are not really helpful or constructive. –  JNK Jun 12 '13 at 12:06
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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