knorv
knorv

Reputation: 50117

How do I re-create a MySQL InnoDB table from an .ibd file?

Assume that the following MySQL files have been restored from a backup tape:

Furthermore, assume that the MySQL installation was running with innodb_file_per_table and that the database was cleanly shutdown with mysqladmin shutdown.

Given a fresh install of the same MySQL version that the restored MySQL files were taken from, how do I import the data from tablename.ibd/tablename.frm into this new install?

Upvotes: 26

Views: 64403

Answers (4)

Jin Lin
Jin Lin

Reputation: 606

I posted the correct solution when you lost ib_logfiles and ibdata file and you have only .frm and .idb files.

Please take a look at my comment on this link:

Restore table structure from frm and ibd files

This will work for you, too.

Thank you.

Upvotes: 0

Snehasish Sarkar
Snehasish Sarkar

Reputation: 134

Similar thing is answered here. please have a look https://stackoverflow.com/a/10943833/3985205

Yes this is possible. It is not enough you just copy the .frm files to the to the databse folder but you also need to copy the ib_logfiles and ibdata file into your data folder. I have just copy the .frm files and copy those files and just restart the server and my database is restored.

Upvotes: 3

Nandit
Nandit

Reputation: 91

This not may work in all cases. But yes it is working in some case...

First stop all the services related to wamp or xampp which you use.

Then copy and past the tablename.frm, tablename.ibd

files under mysql/data/DATABASE NAME FOLDER. then start all the services again. the tablet created under that DB.

Upvotes: -1

Sergiy Tytarenko
Sergiy Tytarenko

Reputation: 482

You must bring the table into the tablespace:

https://www.percona.com/doc/percona-xtrabackup/2.2/innobackupex/restoring_individual_tables_ibk.html

ALTER TABLE mydatabase.tablename IMPORT TABLESPACE;

There is also a exp/cfg file you must have.

Upvotes: 0

Related Questions