could not open single-table tablespace file .\mysql\innodb_index_stats.ibd

qq_37113911 2018-07-30 11:09:37
删除数据data下数据库文件 后导致数据库崩溃:

错误log:2017-06-12 17:42:05 9112 [Note] InnoDB: The log sequence numbers 6045102 and 6045102 in ibdata files do not match the log sequence number 46694188 in the ib_logfiles!
2017-06-12 17:42:05 9112 [Note] InnoDB: Database was not shutdown normally!
2017-06-12 17:42:05 9112 [Note] InnoDB: Starting crash recovery.
2017-06-12 17:42:05 9112 [Note] InnoDB: Reading tablespace information from the .ibd files...
2017-06-12 17:42:05 9112 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace jeesite/act_ge_property uses space ID: 2 at filepath: .\jeesite\act_ge_property.ibd. Cannot open tablespace mysql/innodb_index_stats which uses space ID: 2 at filepath: .\mysql\innodb_index_stats.ibd
InnoDB: Error: could not open single-table tablespace file .\mysql\innodb_index_stats.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal

如果文件系统或者磁盘损坏了,你不能删除.ibd文件,你可以设置innodb_force_recovery>0(其实就是让我们在[mysqld]下增加一行配置innodb_force_recovery=1)在my.cnf,这样就可以强制InnoDB继续崩溃恢复。
网上有人说方法三可能会导致近期操作过那张表的数据丢失,不过能运行起来才是正道。所以我也管不了那么多,就直接按照方法3)操作了,并解决了问题。

启动成功后,如果操作相关数据报错(如Navicat进行数据库传输 失败):
解决
把 原来innodb_force_recovery=1改为默认 innodb_force_recovery=0
重新mysql启动。看是否正常

...全文
467 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

22,210

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧