Mysql
MYSQL:崩潰或關閉後不支持升級 innodb_fast_shutdown = 2
我有一個在 docker 容器中執行的 mysql 伺服器。我嘗試將數據庫從版本 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
然後我嘗試在版本 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
有什麼想法可以解決這個問題嗎?
首先備份你的mysql數據目錄。然後刪除文件 ib_logfile*. 當您啟動 mysql 時,它將創建新的空日誌文件。
此外,與執行
innodb_fast_shutdown = 2
是一個壞主意。將其更改為 1。您仍然可以快速關閉,但 mysql 將盡最小可能使您的文件進入一致的、可升級的狀態。正如您所發現的,這在執行 Docker 時很重要,因為您的軟體版本可以獨立於您的數據。