1.对frm 表进行解析,刚开始使用的mydqlfrm 解析,但是结果总是出错,后来发现一篇文章<利用工具一键对FRM文件进行表结构解析>中介绍的工具
# curl -s http://get.dbsake.net > dbsake
# chmod u+x dbsake
# dbsake sandbox
# <span style="color: #008000;">下载安装 dbsake 工具</span>
[root@localhost ~]# curl -s get.dbsake.net > dbsake
[root@localhost ~]# chmod u+x dbsake
# <span style="color: #008000;">直接将FRM文件转换成可创建表结构的sql文件</span>
[root@localhost ~]# ./dbsake frmdump /www/ceshi.frm > /www/ceshi.sql
- 导出的表结构直接新建表,
【如果报错ERROR 1808 (HY000): Schema mismatch (Table has ROW_TYPE_COMPACT row format, .ibd file has ROW_TYPE_DYNAMIC row format.)】解决办法就是:在后边新加row_format=COMPACT;
3.执行sql语句清空表空间。
alter table 【table_name】 discard tablespace;
4.然后将要读取的表的.ibd文件复制到新建表的文件夹下然后执行
alter table 【table_name】 import tablespace;
执行ok就可以了。