windows上安裝了XMApp-controller之后間歇性出現MySQL無法啟動,查看日之后發現是innodb的報錯,報錯信息如下:
22-01-04 17:21:38 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-01-04 17:21:38 0 [Note] InnoDB: Setting file 'C:xamppmysqldataibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-01-04 17:21:38 0 [Note] InnoDB: File 'C:xamppmysqldataibtmp1' size is now 12 MB.
2022-01-04 17:21:38 0 [Note] InnoDB: Waiting for purge to start
2022-01-04 17:21:38 0 [Note] InnoDB: 10.4.21 started; log sequence number 49263; transaction id 9584
2022-01-04 17:21:38 0 [Note] InnoDB: Loading buffer pool(s) from C:xamppmysqldataib_buffer_pool
2022-01-04 17:21:38 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-01-04 17:21:38 0 [ERROR] InnoDB: Page [page id: space=0, page number=9] log sequence number 4150152 is in the future! Current system log sequence number 49272.
2022-01-04 17:21:38 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2022-01-04 17:21:38 0 [ERROR] InnoDB: Page [page id: space=0, page number=243] log sequence number 4151094 is in the future! Current system log sequence number 49272.
2022-01-04 17:21:38 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2022-01-04 17:21:38 0 [ERROR] InnoDB: Page [page id: space=0, page number=306] log sequence number 4150564 is in the future! Current system log sequence number 49272.
2022-01-04 17:21:38 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2022-01-04 17:21:38 0 [ERROR] InnoDB: Page [page id: space=0, page number=309] log sequence number 4150665 is in the future! Current system log sequence number 49272.
2022-01-04 17:21:38 0 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
2022-01-04 17:21:38 0 [Note] InnoDB: Buffer pool(s) load completed at 220104 17:21:38
2022-01-04 17:21:38 0 [Note] Server socket created on IP: '::'.
度娘上各種答案無法解決,后來直接看官方文檔,直接上解決方案:
踩坑指南 - - 操作配置前需要做這些操作:
# 1. 將三個文件進行備份后刪除:ib_logfile0、ib_logfile1、ibdata1
# 2. 一定要確認元數據導出成功了
# 3. 當數據導出成功后,刪除原數據庫中的數據是,如果提示不能刪除,可在命令進入MySQL的數據目錄,
手動刪除相關數據庫文件夾或者數據庫文件夾下的數據表文件,前提是數據一定導出或備份成功。
1、配置my.cnf 配置innodb_force_recovery = 1 到 6 試到正確為止,重啟MySQL
2、導出數據腳本 mysqldump -uroot -p123456 test > test.sql 導出SQL腳本。或者用Navicat將所有數據庫/表導入到其他服務器的數據庫中。 注意:這里的數據一定要備份成功。然后刪除原數據庫中的數據。
3、刪除ib_logfile0、ib_logfile1、ibdata1 備份MySQL數據目錄下的ib_logfile0、ib_logfile1、ibdata1三個文件,然后將這三個文件刪除
4、配置my.cnf 將my.cnf中innodb_force_recovery 這行配置刪除或者配置為innodb_force_recovery = 0,重啟MySQL服務
5、將數據導入MySQL數據庫 mysql -uroot -p123456 test < test.sql;
或者用Navicat將備份的數據導入到數據庫中。 如果在導入數據過程中發生tablespace不存在的問題,請刪除data目錄相應database下的文件。