【MySQL】记录解决Innodb文件损坏问题

问题
2020-06-10 06:29:15 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."pm_daily" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:42:30 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:42:30 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."pm_daily" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 06:42:40 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:42:40 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."pm_daily" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 06:42:51 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:42:51 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."pm_daily" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 06:43:31 7f16b2294700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:43:31 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."pm_member" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:43:41 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:43:41 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."pm_member" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 06:44:12 7f16b2294700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:44:12 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."pm_milestone" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:44:52 7f16b2294700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:44:52 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."pm_notificate" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:45:02 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:45:02 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."pm_notificate" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 06:45:27 7f16b2294700 InnoDB: 
Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:45:27 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."pm_notificate_users" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:45:37 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:45:37 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."pm_notificate_users" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 06:45:57 7f16b2294700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:45:57 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."pm_project" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:46:31 7f16b2294700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:46:31 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."pm_sonar" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:46:41 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:46:41 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."pm_sonar" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 06:47:03 7f16b2294700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:47:03 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."sys_data_dict" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:47:13 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:47:13 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."sys_data_dict" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 06:47:35 7f16b2294700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:47:35 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."sys_permission_config" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:47:45 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:47:45 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."sys_permission_config" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 06:48:12 7f16b2294700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:48:12 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."sys_role" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:48:22 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:48:22 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."sys_role" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 06:48:45 7f16b2294700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:48:45 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."sys_role_permission" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:48:55 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:48:55 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."sys_role_permission" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 06:49:14 7f16b2294700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:49:14 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."sys_user" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:49:24 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:49:24 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."sys_user" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 06:49:45 7f16b2294700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:49:45 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."sys_user_level" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:49:55 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:49:55 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."sys_user_level" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 06:50:13 7f16b2294700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:50:13 7f16b2294700 InnoDB: Error: Fetch of persistent statistics requested for table "pm"."sys_user_role" but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have unexpected structure. Using transient stats instead.
2020-06-10 06:50:23 7f16a9ffb700 InnoDB: Error: Table "mysql"."innodb_table_stats" not found.
2020-06-10 06:50:23 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."sys_user_role" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.
2020-06-10 07:11:55 1 [Note] mysqld: Normal shutdown

由上面CLI输出可以看出,MySQL在启动的时候报了一个“表”错误。我们择取其中一段开看看:

2020-06-10 06:49:55 7f16a9ffb700 InnoDB: Recalculation of persistent statistics requested for table "pm"."sys_user_level" but the required persistent statistics storage is not present or is corrupted. Using transient stats instead.

上面语句已经说得很明白了,MySQL系统在启动时需要做持久性统计,但是该统计的存储信息已经损坏,所以只能采用瞬时统计模式。emmmmm~,这里只需要了解到文件块已经被“损坏”就够了,至于Innodb的块损坏一般来说我们都会尝试先使用Recover模式恢复,实在不行再说。


解决

这个时候先将当前的应用停止,之后在mysql.cnf中加入innodb_force_recovery = 1配置,然后重新启动服务。

幸运的是,通过使用Recover模式后MySQL居然能够正常启动了。但是当我们重新将innodb_force_recovery关闭后,系统就恢复原样又启动不了了。简单来说MySQL的Recover模式就好像Windows安全模式一样只是一种过渡的状态。

因此,我们需要先使用Recover模式进入MySQL后将受影响的数据库中所有内容以SQL方式导出(这里之所以不用Dump导出是因为提示上面说到的,是持久性统计遭到破坏或者丢失了。而Dump导出会全环境内容导出的,所以这里建议采用SQL方式导出)。

导出完毕后将当前schema删掉并关闭MySQL服务并将innodb_force_recovery注释掉。之后按照正常的方式启动并通过脚本重建库和表并将数据导入就可以了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Kida 的技术小屋

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值