恢复 recover_user.ibd 文件
1.创建数据库recover_ibd
![](https://img2018.cnblogs.com/blog/1706925/201910/1706925-20191029163956007-935092962.png)
2.创建相同结构表(若有其他库中相同结构表,可根据show create table recover_user;获取建表语句)
-- 执行该查询结果中create table语句
CREATE TABLE `recover_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(32) DEFAULT NULL,
`sex` int(11) DEFAULT NULL,
`id_card` varchar(32) DEFAULT NULL,
`address` varchar(128) DEFAULT NULL,
`backup` varchar(128) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `index_id_card` (`id_card`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=130 DEFAULT CHARSET=utf8
![](https://img2018.cnblogs.com/blog/1706925/201910/1706925-20191029164153126-1512484138.png)
3.解除表空间关联关系
ALTER TABLE recover_user DISCARD TABLESPACE;
![](https://img2018.cnblogs.com/blog/1706925/201910/1706925-20191029164257788-1299304015.png)
4.查看数据库对应表物理文件位置,此时新库目录下为空(若未解除表空间关系,创建表之后应有recover_user.ibd文件)
![](https://img2018.cnblogs.com/blog/1706925/201910/1706925-20191029164324168-839036507.png)
5.复制recover_user.ibd 文件至mysql Data目录下对应数据库中
![](https://img2018.cnblogs.com/blog/1706925/201910/1706925-20191029164528179-1709502134.png)
6.建立新的表空间关联关系
ALTER TABLE recover_user IMPORT TABLESPACE;
![](https://img2018.cnblogs.com/blog/1706925/201910/1706925-20191029164541115-1273967368.png)
7.查看恢复结果
select * from recover_user;
![](https://img2018.cnblogs.com/blog/1706925/201910/1706925-20191029164621379-426974290.png)