2

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.

1
  • Write a script to go through the 800.
    – Rick James
    Dec 22, 2016 at 0:50

1 Answer 1

1

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.

4
  • ok...thanks for the reply. I did see the ib_logfile0, ib_logfile1, and ibdata1 in the parent where the database files are, and it looks like the MySQL-prod.ini file is in the root of the MySQL installation directory. I am going to downgrade my database on my machine to match the version of the MySQL I'm trying to re-construct. I don't care what version of MySQL I use, as long as I can get to the data. Thanks, kriegu, this is good info and very helpful!!
    – user113329
    Jan 5, 2017 at 20:08
  • the only MySQL 5.5 I can find is mysql-5.5.54, and from a sql file I found, the version is APP VERSION : 5.5.0c_Update04 -- DB VERSION : 5.5.0c_Update04 ....... hope that wont matter :S
    – user113329
    Jan 5, 2017 at 20:16
  • 1
    It doesn't matter, the important thing here is that you use the same version 5.5.x. Make sure once you install, and start the new version, run the mysql_upgrade script. Syntax: mysql_upgrade -u root -p.... That script will update datafile headers to match the new version, and will also add/remove columns that were modified between those versions (5.5.0 and 5.5.54). More info: dev.mysql.com/doc/refman/5.5/en/mysql-upgrade.html
    – kriegu
    Jan 5, 2017 at 23:14
  • 1
    after all that, i decided to use hiren's boot cd to reset the admin password to the machine. then i was able to add a startup script to the mysql instance to reset the password, then restarted the mysql service. got in, and everything works.
    – user113329
    Feb 13, 2017 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.