Mysql启动异常的处理

表文件损坏报错

2023-11-29 18:04:43 0 [Note] InnoDB: Uncompressed page, stored checksum in field1 605723794, calculated checksums for field1: crc32 1862675323, innodb 3017047818,  page type 50615 == PAGE TYPE CORRUPTED.none 3735928559, stored checksum in field2 1359156322, calculated checksums for field2: crc32 1862675323, innodb 1935580650, none 3735928559,  page LSN 2552588239 1064823489, low 4 bytes of LSN at page end 1951679811, page number (if stored to page already) 1837485677, space id (if created with >= MySQL-4.1.1 and stored already) 821414241
2023-11-29 18:04:43 0 [Note] InnoDB: It is also possible that your operating system has corrupted its own file cache and rebooting your computer removes the error. If the corrupt page is an index page. You can also try to fix the corruption by dumping, dropping, and reimporting the corrupt table. You can use CHECK TABLE to scan your table for corruption. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2023-11-29 18:04:43 0 [ERROR] InnoDB: Space id and page no stored in the page, read in are [page id: space=821414241, page number=1837485677], should be [page id: space=1334, page number=1]
2023-11-29 18:04:43 0 [ERROR] InnoDB: Database page corruption on disk or a failed file read of tablespace dcom/itom_base_users page [page id: space=1334, page number=1]. You may have to recover from a backup.
2023-11-29 18:04:43 0 [Note] InnoDB: Page dump in ascii and hex (16384 bytes):
2023-11-29 18:04:43 0 [Note] InnoDB: Uncompressed page, stored checksum in field1 605723794, calculated checksums for field1: crc32 1862675323, innodb 3017047818,  page type 50615 == PAGE TYPE CORRUPTED.none 3735928559, stored checksum in field2 1359156322, calculated checksums for field2: crc32 1862675323, innodb 1935580650, none 3735928559,  page LSN 2552588239 1064823489, low 4 bytes of LSN at page end 1951679811, page number (if stored to page already) 1837485677, space id (if created with >= MySQL-4.1.1 and stored already) 821414241
2023-11-29 18:04:43 0 [Note] InnoDB: It is also possible that your operating system has corrupted its own file cache and rebooting your computer removes the error. If the corrupt page is an index page. You can also try to fix the corruption by dumping, dropping, and reimporting the corrupt table. You can use CHECK TABLE to scan your table for corruption. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2023-11-29 18:04:43 0 [ERROR] InnoDB: Space id and page no stored in the page, read in are [page id: space=821414241, page number=1837485677], should be [page id: space=1334, page number=1]
2023-11-29 18:04:43 0 [ERROR] InnoDB: Database page corruption on disk or a failed file read of tablespace dcom/itom_base_users page [page id: space=1334, page number=1]. You may have to recover from a backup.
2023-11-29 18:04:43 0 [Note] InnoDB: Page dump in ascii and hex (16384 bytes)

使用innodb_force_recovery参数来恢复,innodb_force_recovery参数有6个选项具体如下:

1 (SRV_FORCE_IGNORE_CORRUPT)

Lets the server run even if it detects a corrupt page. Tries to make SELECT * FROM tbl_name jump over corrupt index records and pages, which helps in dumping tables.

2 (SRV_FORCE_NO_BACKGROUND)

Prevents the master thread and any purge threads from running. If a crash would occur during the purge operation, this recovery value prevents it.

3 (SRV_FORCE_NO_TRX_UNDO)

Does not run transaction rollbacks after crash recovery.

4 (SRV_FORCE_NO_IBUF_MERGE)

Prevents insert buffer merge operations. If they would cause a crash, does not do them. Does not calculate table statistics.

This value can permanently corrupt data files. After using this value, be prepared to drop and recreate all secondary indexes. Sets InnoDB to read-only.

5 (SRV_FORCE_NO_UNDO_LOG_SCAN)

Does not look at undo logs when starting the database: InnoDB treats even incomplete transactions as committed.

This value can permanently corrupt data files. Sets InnoDB to read-only.

6 (SRV_FORCE_NO_LOG_REDO)

Does not do the redo log roll-forward in connection with recovery. This value can permanently corrupt data files.

Leaves database pages in an obsolete state, which in turn may introduce more corruption into B-trees and other database structures. Sets InnoDB to read-only.

尽量用最小的参数尝试启动,大的包含小的:

innodb_force_recovery=1

修改参数以后启动成功,mysqlcheck工具检查看具体哪个表的文件损坏:

## 
mysqlcheck -A -uroot -p
解决

如果有损坏可以先从其他服务器备份出来删除原表在导入进去。

你可能感兴趣的:(#,Mysql,mysql)