I use innodb_file_per_table configuration parameter. I want to archive some old tables. If I shutdown the database and move the ibd and frm to archive directory, innodb shows warning that table.ibd is not available. Is there a way to move a table away from database?
Are you familiar with
mysqldump
? It's a tool that creates a file full of SQL statements that will recreate the tables you asked it to dump and import the data they contained. It's a part of the standard MySQL install.You can use it like this:
By default the dump includes
CREATE TABLE
statements.You can restore like this:
Do not try to do this kind of thing at the filesystem level, especially not with innodb tables. That's a sure road to disappointment. Do as Ladadadada suggests and dump the table, save the dump file as your archive and then drop the table. That way it is also easily restorable, not just to the original server but to any server.
What you can do is to rename your table using below command
In the MySQL client:
Where
<table spec>
is the result of theSHOW CREATE TABLE
command.Then in your shell:
Back in the MySQL client: