user1844626
user1844626

Reputation: 1868

How can move InnoDB table from one pc to another pc?


I've a table 'admin' and I want to move that with all data from one location to another. If I use MyISAM engine then I get 3 files 'admin.frm','admin.MYD' and 'admin.MYI' for 'admin' table in data folder, and I can copy and paste those files to another location and can run the table. but if I use InnoDB engine then I get only 'admin.frm' in data folder and when copy that file to another location then the table can't be run.

Anybody please tell me how can I move InnoDB table from one location to another ?

-Thanks.

Edit: (I need to transfer data and structure too(as entire table).I want it simple copy paste like MyISAM table files. is it possible ? and how ?)

Upvotes: 0

Views: 583

Answers (3)

Aman Aggarwal
Aman Aggarwal

Reputation: 18479

Move Innodb using tablespace methods in 5.6 version:

1) Create empty table on destination server/database same as on source server.

2) Discard tablespace on destination server.

Alter Table table_name discard tablespace.

3) Copy .frm and .ibd to destination server after executing "flush tables with read lock" on source server.

4) Import tablespace on destination server :

ALTER TABLE table_name IMPORT TABLESPACE;

Upvotes: 0

Aea
Aea

Reputation: 976

If you just need to transfer data it may be simpler to use the built in tools, as so...

Use mysqldump to get your table, a very simple example:

mysqldump -u USERNAME -p DATABASE admin > admin.sql

And then on the other computer:

mysql -u USERNAME -p DATABASE < admin.sql

Upvotes: 2

regulatethis
regulatethis

Reputation: 2362

Why not use mysqldump to dump all the data to a file which you can then run on the other machine?

Upvotes: 1

Related Questions