In server versions prior to 5.6, it is not possible to copy tables between servers by copying the files, even with innodb_file_per_table. However, with Percona XtraBackup, you can export individual tables from any InnoDB database, and import them into Percona Server with XtraDB or MySQL 5.6. (The source doesn’t have to be XtraDB or or MySQL 5.6, but the destination does.) This only works on individual .ibd files, and cannot export a table that is not contained in its own .ibd file.
Let’s see how to export and import the following table:
CREATE TABLE export_test ( a int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
$ find /data/backups/mysql/ -name export_test.* /data/backups/mysql/test/export_test.ibd
when you prepare the backup, add the extra parameter --export to the command. Here is an example:
$ xtrabackup --prepare --export --target-dir=/data/backups/mysql/
Now you should see a .exp file in the target directory:
$ find /data/backups/mysql/ -name export_test.* /data/backups/mysql/test/export_test.exp /data/backups/mysql/test/export_test.ibd /data/backups/mysql/test/export_test.cfg
These three files are all you need to import the table into a server running Percona Server with XtraDB or MySQL 5.6.
MySQL uses .cfg file which contains InnoDB dictionary dump in special format. This format is different from the .exp one which is used in XtraDB for the same purpose. Strictly speaking, a .cfg file is not required to import a tablespace to MySQL 5.6 or Percona Server 5.6. A tablespace will be imported successfully even if it is from another server, but InnoDB will do schema validation if the corresponding .cfg file is present in the same directory.
On the destination server running Percona Server with XtraDB and innodb_import_table_from_xtrabackup option enabled, or MySQL 5.6, create a table with the same structure, and then perform the following steps:
The table should now be imported, and you should be able to SELECT from it and see the imported data.