ITPub博客

首页 > 数据库 > MySQL > Mysql表空间迁移

Mysql表空间迁移

原创 MySQL 作者:wzgchen 时间:2015-08-04 17:23:00 0 删除 编辑


目标库:
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;

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/91975/viewspace-1761774/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: Mysql index_merge
请登录后发表评论 登录
全部评论

注册时间:2015-05-01

  • 博文量
    383
  • 访问量
    213567