如何修复此 MySQL InnoDB 页面损坏?

问题描述 投票:0回答:0

不久前我在我的服务器上建立了一个项目,它会定期将一些数据写入MySQL数据库。

今天我决定自己做一个简单的好网站来查看数据,但是当我尝试访问数据库时,mysql 服务会失败。

日志显示以下错误。

2023-04-25T17:18:53.925280Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.32-0ubuntu0.20.04.2) starting as process 2892149
2023-04-25T17:18:53.931297Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-04-25T17:18:53.955881Z 1 [ERROR] [MY-012239] [InnoDB] Space ID in fsp header is 2268439514, but in the page header it is 821414241.
2023-04-25T17:18:53.955931Z 1 [ERROR] [MY-012222] [InnoDB] Data file './ibdata1' uses page size 8192, but the innodb_page_size start-up parameter is 16384
2023-04-25T17:18:53.956017Z 1 [ERROR] [MY-012237] [InnoDB] Corrupted page [page id: space=4294967295, page number=0] of datafile './ibdata1' could not be found in the doublewrite buffer.
2023-04-25T17:18:53.956058Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2023-04-25T17:18:54.456170Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2023-04-25T17:18:54.456564Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2023-04-25T17:18:54.456622Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-04-25T17:18:54.457375Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.32-0ubuntu0.20.04.2)  (Ubuntu).

我花了一整天的时间尝试恢复/修复数据,但没有成功。我试过以下方法:

  • 添加来自
    /var/lib/mysql
  • 的软链接
  • 将文件夹的内容复制到
    /var/lib/mysql
  • 只复制目标数据库的内容到
    /var/lib/mysql
    .在 mysqld 设置中添加
    innodb_force_recovery

我只恢复了some表的数据。接下来我应该尝试什么?

另外,我做错了什么,我怎样才能防止以后发生这样的事情呢?

谢谢!

我花了一整天的时间尝试恢复/修复数据,但没有成功。我试过以下方法:

  • 添加来自
    /var/lib/mysql
  • 的软链接
  • 将文件夹的内容复制到
    /var/lib/mysql
  • 只复制目标数据库的内容到
    /var/lib/mysql
    .在 mysqld 设置中添加
    innodb_force_recovery

编辑 手动将

innodb-page-size
设置为上一个错误预期的值后,我现在收到此错误。

2023-04-25T17:29:54.450580Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.32-0ubuntu0.20.04.2)  (Ubuntu).
2023-04-25T17:29:55.165937Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.32-0ubuntu0.20.04.2) starting as process 2892457
2023-04-25T17:29:55.169698Z 0 [Warning] [MY-012363] [InnoDB] innodb-page-size has been changed from the default value 16384 to 8192.
2023-04-25T17:29:55.171263Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-04-25T17:29:55.193483Z 1 [ERROR] [MY-012239] [InnoDB] Space ID in fsp header is 2268439514, but in the page header it is 821414241.
2023-04-25T17:29:55.193881Z 1 [ERROR] [MY-012224] [InnoDB] Tablespace flags are invalid in datafile: ./ibdata1, Space ID:4294967295, Flags: 2691266817. Please refer to http://dev.mysql.com/doc/refman/8.0/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2023-04-25T17:29:55.193899Z 1 [ERROR] [MY-012237] [InnoDB] Corrupted page [page id: space=4294967295, page number=0] of datafile './ibdata1' could not be found in the doublewrite buffer.
2023-04-25T17:29:55.193912Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Data structure corruption.
2023-04-25T17:29:55.693864Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2023-04-25T17:29:55.694592Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2023-04-25T17:29:55.694656Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-04-25T17:29:55.695448Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.32-0ubuntu0.20.04.2)  (Ubuntu).
sql mysql database innodb corruption
© www.soinside.com 2019 - 2024. All rights reserved.