Mysql表空间迁移



目标库:
cd /usr/local/mysql/data/test
chown mysql:mysql *

CREATE TABLE t1 (
  i1 int(11) NOT NULL DEFAULT '0',
  i2 int(11) NOT NULL DEFAULT '0',
  d date DEFAULT NULL,
  PRIMARY KEY (i1,i2),
  KEY k_d (d)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

alter table t1 discard tablespace;

源库:
flush tables t1 for export;
scp t1.* 192.168.168.144:/usr/local/mysql/data/test
unlock tables;
show create table t1\G;


目标库:
chown mysql:mysql *
alter table t1 import tablespace;

请使用浏览器的分享功能分享到微信等