>show variables like '%per_table%'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | innodb_file_per_table | ON | +-----------------------+-------+ 1 row in set (0.00 sec)
-rw-rw---- 1 mysql mysql 8602 Feb 13 23:10 users.frm -rw-rw---- 1 mysql mysql 11534336 Mar 12 22:55 users.ibd數(shù)據(jù)情況:
> select count(*) from users; +----------+ | count(*) | +----------+ | 20001 | +----------+ 1 row in set (0.01 sec)我們開始遷移數(shù)據(jù),首先要生成一個cfg文件,導(dǎo)出配置信息。
-rw-rw---- 1 mysql mysql 599 Mar 13 08:17 users.cfg -rw-rw---- 1 mysql mysql 8602 Feb 13 23:10 users.frm -rw-rw---- 1 mysql mysql 11534336 Mar 12 22:55 users.ibd在flush table之后,這個表users就被鎖定了,DML操作是阻塞的,也就意味著遷移的過程中,是無法直接寫入數(shù)據(jù)的。
> alter table users import tablespace; ERROR 1808 (HY000): Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x1)或者下面的錯誤:
> alter table users import tablespace; ERROR 1808 (HY000): Schema mismatch (Table has ROW_TYPE_DYNAMIC row format, .ibd file has ROW_TYPE_COMPACT row format.)通過錯誤信息可以發(fā)現(xiàn)和表的一個屬性有關(guān)。我們先解決問題,添加屬性row_format