InnoDB: Error: checksum mismatch in data file /www/server/data/ibdata1问题处理
Posted on 2022-06-26 07:30 高&玉 阅读(682) 评论(0) 编辑 收藏 举报问题背景
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导出的数据导入到新环境中
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示