MYSQL:崩溃或 innodb_fast_shutdown = 2 关闭后不支持升级

Tam*_*ert 6 mysql docker

我有一个 mysql 服务器在 docker 容器中运行。我尝试将数据库从版本 8.0.29 升级到版本 8.0.30。但是启动时,出现了如下错误:

2022-09-06T13:13:39.928986Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
2022-09-06T13:13:40.701091Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-09-06T13:13:40.954725Z 1 [ERROR] [MY-012526] [InnoDB] Upgrade is not supported after a crash or shutdown with innodb_fast_shutdown = 2. This redo log was created with MySQL 8.0.29, and it appears logically non empty. Please follow the instructions at http://dev.mysql.com/doc/refman/8.0/en/upgrading.html
2022-09-06T13:13:40.954752Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2022-09-06T13:13:41.328075Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-09-06T13:13:41.328265Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-09-06T13:13:41.328299Z 0 [ERROR] [MY-010119] [Server] Aborting
Run Code Online (Sandbox Code Playgroud)

然后我尝试在版本 8.0.29 中重新启动,但这也不再有效 - 错误消息是:

2022-09-06T13:31:18.544142Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.29) starting as process 1
2022-09-06T13:31:18.682671Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-09-06T13:31:24.588234Z 1 [ERROR] [MY-013171] [InnoDB] Cannot boot server version 80029 on data directory built by version 80030. Downgrade is not supported
mysqld: Can't open file: 'mysql.ibd' (errno: 0 - )
2022-09-06T13:31:25.243497Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-09-06T13:31:25.243720Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-09-06T13:31:25.243968Z 0 [ERROR] [MY-010119] [Server] Aborting
Run Code Online (Sandbox Code Playgroud)

我有什么想法可以解决这个问题吗?

lon*_*eck 7

首先备份你的mysql数据目录。然后删除文件 ib_logfile*. 当您启动 mysql 时,它将创建新的空日志文件。

另外,一起跑步innodb_fast_shutdown = 2也是一个坏主意。将其更改为 1。您仍然可以快速关闭,但 mysql 会尽最大可能使您的文件进入一致的、可升级的状态。正如您所发现的,这在运行 Docker 时非常重要,因为您的软件版本可以独立于数据。