Mysql – Import .frm and .ibd files into a new instance of MySQL

importMySQLrecovery

I have the .frm and .ibd files from an old, non-working MySQL server (on Windows). I took out the hard drive and was able to get the data directory copied to my machine.

How would I get them into MySQL on my development machine? I tried just copying the directory into the MySQL data directory, but that didn't work.

The old database is v5.5.4, and my version is v5.7.15. I'd be happy to install a matching MySQL version if that would help.

I saw Restoring MySQL Tables from .ibd, .frm and mysqllogbin files, but this database has over 800 tables in it – way too much for that process.

Best Answer

It should work copying the whole data directory to the target machine given the following conditions:

  1. You must have the whole data directory (ibdata1 and iblogfiles included).
  2. Try to use the same my.ini file.
  3. The OS where the source DB files were running must be the same as of the target OS.
  4. Try to use MySQL 5.5.x. If you need to upgrade to 5.7 you must first install 5.6.x and run mysql_upgrade script, install 5.7.x and run again mysql_upgrade script, OR install 5.5.x, run a mysqldump, and then importing the dumpfile on 5.7.x.

If you don't have the ibdata1 and iblogfiles then you must apply the procedure of the thread that you shared, scripting as Rick suggested.