mysql innodb的表由.frm .ibd 组成,
frm:存了每个表的元数据,包括表结构的定义等;
ibd:存了每个表的元数据,包括表结构的定义等;
1.人工导入数据库表结构
-> dr_1_block.frm
or 批量生成sql
SELECT concat('alter table ', table_name, ' discard tablespace;') FROM information_schema.tables WHERE table_schema = 'htmltoo';
2.清除表空间
ALTER TABLE dr_1_block DISCARD TABLESPACE;
3.修改权限
chown -R mysql:mysql *
chmod -R 640 *
4.输入表空间
ALTER TABLE dr_1_block IMPORT TABLESPACE;
or 批量生成sql
SELECT concat('alter table ', table_name, ' IMPORT tablespace;') FROM information_schema.tables WHERE table_schema = 'htmltoo';
5.设置 innodb_force_recovery 参数,该参数可以让数据库在启动时尝试修复损坏的数据表:
SET GLOBAL innodb_force_recovery = 1;
-修复完成后,将 innodb_force_recovery 参数设置为0
SET GLOBAL innodb_force_recovery = 0;
签名:这个人很懒,什么也没有留下!