ITPub博客

首页 > 数据库 > MySQL > MySQL数据库迁移后,无法启动故障处理,一波好几折

MySQL数据库迁移后,无法启动故障处理,一波好几折

原创 MySQL 作者:chenoracle 时间:2026-09-18 16:21:29 0 删除 编辑

问题现象:

MySQL数据库,迁移到新服务器后,无法启动,报错如下:

2026-06-23T10:36:16.263666+08:00 0 [Warning] [MY-010097] [Server] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2026-06-23T10:36:16.263735+08:00 0 [System] [MY-010116] [Server] /mysqldata/app/8.0.32/bin/mysqld (mysqld 8.0.32) starting as process 2117351
2026-06-23T10:36:16.271718+08:00 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2026-06-23T10:36:18.759023+08:00 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.27, and it appears logically non empty. Please follow the instructions at http://dev.mysql.com/doc/refman/8.0/en/upgrading.html
2026-06-23T10:36:18.759060+08:00 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2026-06-23T10:36:19.129260+08:00 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2026-06-23T10:36:19.129422+08:00 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2026-06-23T10:36:19.129446+08:00 0 [ERROR] [MY-010119] [Server] Aborting
2026-06-23T10:36:19.129915+08:00 0 [System] [MY-010910] [Server] /mysqldata/app/8.0.32/bin/mysqld: Shutdown complete (mysqld 8.0.32)  MySQL Community Server - GPL.

错误分析:
1.This redo log was created with MySQL 8.0.27日志说明 redo log记录的MySQL版本是 8.0.27,但是当前启动的版本是 8.0.32;
2.logically non empty 说明 redo log 中仍然包含未处理的日志记录;
3.Upgrade is not supported after a crash or shutdown with innodb_fast_shutdown=2 说明启动数据库时,InnoDB 尝试从 8.0.27 升级到 8.0.32 需要做 redo log 格式升级,但这种升级 只允许在正常(干净)关闭之后进行,不允许在崩溃恢复或 innodb_fast_shutdown=2 之后进行。因为此时 redo 里可能还有未应用的事务,强制升级可能导致数据不一致,所以直接拒绝启动。

尝试解决:

看日志像是MySQL版本是 8.0.27 ,而不是 8.0.32,上传 8.0.27 软件,启动是否可行?
答案是,仍然报错,报错信息如下:

2026-06-23T10:42:44.617387+08:00 0 [Warning] [MY-010097] [Server] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2026-06-23T10:42:44.617460+08:00 0 [System] [MY-010116] [Server] /mysqldata/app/8.0.27/bin/mysqld (mysqld 8.0.27) starting as process 2133756
2026-06-23T10:42:44.626474+08:00 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2026-06-23T10:42:49.058622+08:00 1 [ERROR] [MY-013171] [InnoDB] Cannot boot server version 80027 on data directory built by version 80032. Downgrade is not supported
mysqld: Can't open file: 'mysql.ibd' (errno: 0 - )
2026-06-23T10:42:54.051319+08:00 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2026-06-23T10:42:54.051501+08:00 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2026-06-23T10:42:54.051733+08:00 0 [ERROR] [MY-010119] [Server] Aborting
2026-06-23T10:42:54.052248+08:00 0 [System] [MY-010910] [Server] /mysqldata/app/8.0.27/bin/mysqld: Shutdown complete (mysqld 8.0.27)  MySQL Community Server - GPL.

错误分析:
Cannot boot server version 80027 on data directory built by version 80032. Downgrade is not supported
说明 数据库是 8.0.32 版本,不是 8.0.27版本,不允许降级操作。

疑问:

用 8.0.32 软件启动MySQL时,提示 redo log 记录的是 8.0.27版本,所以启动报错;
用 8.0.27 软件启动MySQL时,又提示 当前数据库是 8.0.32 版本,启动又报错了。

问题原因:

迁移后的服务器不干净,默认安装了 8.0.27 软件,迁移后初次启动 8.0.32 数据库时,使用的时8.0.27的软件,报错如下:

2026-06-23T09:53:06.026366+08:00 0 [Warning] [MY-010097] [Server] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2026-06-23T09:53:06.026438+08:00 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.27) starting as process 2009181
2026-06-23T09:53:06.026487+08:00 0 [ERROR] [MY-010338] [Server] Can't find error-message file '/mysqldata/app/8.0.32/share/mysql-8.0/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2026-06-23T09:53:06.050635+08:00 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2026-06-23T09:53:08.473253+08:00 1 [ERROR] [MY-013171] [InnoDB] Cannot boot server version 80027 on data directory built by version 80032. Downgrade is not supported
mysqld: Can't open file: 'mysql.ibd' (errno: 0 - )
2026-06-23T09:53:13.380807+08:00 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2026-06-23T09:53:13.380983+08:00 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2026-06-23T09:53:13.381203+08:00 0 [ERROR] [MY-010119] [Server] Aborting
2026-06-23T09:53:13.382004+08:00 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.27)  MySQL Community Server - GPL.

通过日志:
Cannot boot server version 80027 on data directory built by version 80032. Downgrade is not supported
可以知道,数据库确实是 8.0.32版本,尝试使用 8.0.27 软件启动时,虽然启动失败了,但是破坏了 redo log 版本:

可以看到,用 8.0.27 软件 启动 8.0.32 MySQL时,redo log file文件头,被刷新为 8.0.27 版本了

root@cjc-db-01:/mysqldata_bak/3308/redo#hexdump -C ib_logfile0 |head -n 20
00000000  00 00 00 04 00 00 00 00  00 00 00 07 f4 9c 16 00  |................|
00000010  4d 79 53 51 4c 20 38 2e  30 2e 32 37 00 00 00 00  |MySQL 8.0.27....|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

但是数据文件都是 8.0.32版本的,所以启动失败。

解决方案:

1.卸载已经不再使用的 8.0.27软件;
2.重新恢复 8.0.32 的物理备份后,可以正常启动。

欢迎关注我的公众号《 IT小Chen》

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29785807/viewspace-3182996/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle ACE、OCMU 用户组成员、Oracle 11g OCM、微信公众号"IT小Chen"

注册时间:2014-08-05

  • 博文量
    853
  • 访问量
    2719577