随笔 - 136, 文章 - 0, 评论 - 14, 阅读 - 13万
  首页  :: 新随笔  :: 管理
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

问题背景

MySQL 5.6

CentOS 7.6

 

MySQL所在主机因异常断电导致数据库宕机,MySQL重新启动报如下错误:

220615  9:58:27 [Note] Plugin 'FEDERATED' is disabled.
220615  9:58:27 InnoDB: The InnoDB memory heap is disabled
220615  9:58:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins
220615  9:58:27 InnoDB: Compressed tables use zlib 1.2.11
220615  9:58:27 InnoDB: Using Linux native AIO
220615  9:58:27 InnoDB: Initializing buffer pool, size = 2.0G
220615  9:58:27 InnoDB: Completed initialization of buffer pool
InnoDB: Error: checksum mismatch in data file /www/server/data/ibdata1
220615  9:58:27 InnoDB: Could not open or create data files.
220615  9:58:27 InnoDB: If you tried to add new data files, and it failed here,
220615  9:58:27 InnoDB: you should now edit innodb_data_file_path in my.cnf back
220615  9:58:27 InnoDB: to what it was, and remove the new ibdata files InnoDB created
220615  9:58:27 InnoDB: in this failed attempt. InnoDB only wrote those files full of
220615  9:58:27 InnoDB: zeros, but did not yet use them in any way. But be careful: do not
220615  9:58:27 InnoDB: remove old data files which contain your precious data!
220615  9:58:27 [ERROR] Plugin 'InnoDB' init function returned error.
220615  9:58:27 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
220615  9:58:27 [ERROR] Unknown/unsupported storage engine: InnoDB
220615  9:58:27 [ERROR] Aborting

220615  9:58:27 [Note] /www/server/mysql/bin/mysqld: Shutdown complete

因系统是异常断电,MySQL缓存中的数据未能落盘是导致此次问题的最终原因。

 

解决办法

第一步:在my.cnf文件中[mysqld]下面添加innodb_force_recovery=6

第二步:mysqldump导出mysql全部数据

第三步:重新初始化mysql,部署全新环境

第四步:将mysqldump导出的数据导入到新环境中

相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示
点击右上角即可分享
微信分享提示