database data_error ai_generated partial

InnoDB:磁盘上的数据库页损坏或页面文件读取失败 [页 id:space=123, page number=456]。您可能需要从备份中恢复。

InnoDB: Database page corruption on disk or a failed file read of page [page id: space=123, page number=456]. You may have to recover from a backup.

ID: database/mysql-innodb-redo-log-corruption

其他格式: JSON · Markdown 中文 · English
70%修复率
86%置信度
1证据数
2024-01-22首次发现

版本兼容性

版本状态引入弃用备注
MySQL 8.0 active
MySQL 8.4 active
Percona Server 8.0 active

根因分析

InnoDB 检测到数据页的校验和不匹配,表明 ibd 文件物理损坏或由于硬件问题(例如,坏磁盘扇区、内存损坏)导致读取失败。

English

InnoDB detected a checksum mismatch on a data page, indicating physical corruption of the ibd file or a failed read due to hardware issues (e.g., bad disk sector, memory corruption).

generic

官方文档

https://dev.mysql.com/doc/refman/8.0/en/innodb-recovery.html

解决方案

  1. Set innodb_force_recovery to a value between 1 and 6 in my.cnf, then restart MySQL to bypass the corruption and dump the table: mysqldump -u root mydb my_table > dump.sql. After dump, drop and recreate the table, then restore. Example: innodb_force_recovery = 4.
  2. Restore the affected table from a recent backup using mysqlbinlog or physical backup (e.g., Percona XtraBackup). Example: xtrabackup --prepare --target-dir=/backup; then copy the restored ibd file to the datadir.

无效尝试

常见但无效的做法:

  1. Restart MySQL without any recovery steps, hoping the corruption is transient 95% 失败

    InnoDB will attempt to read the corrupted page again during startup or on access, causing the same error or a crash.

  2. Run REPAIR TABLE on the affected table 100% 失败

    REPAIR TABLE only works for MyISAM tables; for InnoDB, it returns 'The storage engine for the table doesn't support repair'.