InnoDB: Error: checksum mismatch in data file /www/server/data/ibdata1问题处理
Posted on 2022-06-26 07:30 高&玉 阅读(638) 评论(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导出的数据导入到新环境中