mysql表空间传输
限制条件:
1、MySQL(5.6.6及以上);
2、innodb_file_per_table开启(独立表空间);
3、源库与目标库的page_size必须一致(建议源库与目标库版本一致);
4、当做表导出时,该表只能进行只读操作;
适用于单个大表迁移
ERROR 1808 (HY000): Schema mismatch (Table flags don't match,server table has ROW_TYPE_COMPACT and the meta-data file has ROW_TYPE_DYNAMIC)
步骤:
1、目标库执行;
建表,表结构与源表一致;
2、目标库执行;
alter table table_name discard tablespace;
3、源库执行;
flush table table_name for export;
4、源库执行;
scp -r table_name.{cfg,ibd} 目标库
5、目标库执行;
unlock tables;
alter table table_name import tablespace;