@JohnWoo's answer is only for MYSIAM
database engine. My answer is strictly for InnoDb storage engine,i.e., FRM
and IBD
files
To recover
InnoDb
database, I followed exactly these steps successfully. Before pointing out the steps, I would like to tell you that I performed the recovery from recovered hard disk of Wndows XP and transferred it to Windows 7. So, this will help both windows xp and windows 7 users. So, the steps which I followed are :-
- The MySQL server at both the machines MUST be stopped. Of course if the OS/hard disk crashed, the server at that machine is already stopped.
- Now, MySQL installation is in 2 folders (for me at least) ->
1. Program Files / Program Files (x86), and
2. C:\Program Data\MySQL in windows 7 and C:\Users\All users\Application Data\MySQL in Windows XP. Note that Program Data(win7) as well as Application Data(WinXP) are hidden folders.
- We are ONLY CONCERNED with the MySQL Server ** folder in the Application Data or Program Data folders. The Mysql folder in Program Files is of no use as it does not have your data.
- Now Copy the my.ini file in MySQL Server ** folder.
- Open the data folder and copy these files
1. All the ib_logfile* files
2. All the ibdata* files
3. The database folders (that you want) containing .frm and .ibd files
- Now, copy the files mentioned in the above two points in the destination machine. It is highly recommended to take a backup of the replaced files in the destination machine.
- Now, restart the server. If you went right, you would restore your databases without any error.
I would recommend you to have a look at the cold backup method for InnoDB at the mysql docs at dev.mysql.com/doc/mysql-backup-excerpt/5.5/en/innodb-backup.html