MySQL 5.6.金沙官网线上:26 通过frm & ibd 恢复数据过

7.目标端导入表

查询数据
mysql> select * from yoon;
+------+------+
| id | name |
+------+------+
| 1 | HANK |
| 2 | YOON |
| 3 | GARY |
| 4 | NIKO |
+------+------+
4 rows in set (0.00 sec)

    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

插入数据
root(yoon)> insert into yoon values (1,'HANK');
Query OK, 1 row affected (1.01 sec)

alter table tbs.test import tablespace;

在A服务器上创建数据库yoon
root(yoon)> show create table yoonG
*************************** 1. row ***************************
Table: yoon
Create Table: CREATE TABLE `yoon` (
`id` int(11) DEFAULT NULL,
`name` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8

      `id` int(11) DEFAULT NULL

将表结构和空间建立关系
mysql> alter table yoon import tablespace;
Query OK, 0 rows affected, 1 warning (0.04 sec)

1.目标端创建同样的表结构

root(yoon)> select * from yoon;
+------+------+
| id | name |
+------+------+
| 1 | HANK |
| 2 | YOON |
| 3 | GARY |
| 4 | NIKO |
+------+------+
4 rows in set (0.00 sec)

CREATE TABLE `test` (

mysql> use yoon;
Database changed
mysql> CREATE TABLE `yoon` (
-> `id` int(11) DEFAULT NULL,
-> `name` varchar(20) DEFAULT NULL
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.09 sec)

5.源端释放锁

root(yoon)> insert into yoon values (4,'NIKO');
Query OK, 1 row affected (0.02 sec)

chown -R mysql:mysql *

将表结构和空间脱离
mysql> alter table yoon discard tablespace;
Query OK, 0 rows affected (0.02 sec)

chmod -R 755 *

root(yoon)> insert into yoon values (3,'GARY');
Query OK, 1 row affected (0.00 sec)

本文由金沙官网线上发布于数据库,转载请注明出处:MySQL 5.6.金沙官网线上:26 通过frm & ibd 恢复数据过

您可能还会对下面的文章感兴趣: