5

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 https://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.

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
4

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.

  • 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
2

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.

0

At TwinDB we built a web interface to mysqlfrm. It's free and easy to use.

To recover table structure from you just need to upload the .frm file.

Here are steps. 1. Open https://recovery.twindb.com/ . Click on "Recover Structure" enter image description here

  1. In next submenu click on "from .frm file" enter image description here

  2. On the next view click on "Browse" and select an .frm file on a local disk. Click on "Upload" enter image description here

  3. Wait till it's doing the magic enter image description here

  4. Get the recovered structure. enter image description here

It's also possible to upload an archive with a bunch of .frm files. The site will recover them altogether.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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