萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 程式設計 >  >> 資料庫 >> MySQL 教學

Plugin 'InnoDB' registration as a STORAGE ENGINE failed:舊日誌文件殘留導致

錯誤日誌關鍵信息

InnoDB: Error: log file ./ib_logfile0 is of different size ...
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

根因

之前曾啟用過 InnoDB,後來卸載/禁用,**但 ib_logfile0、ib_logfile1 未刪除**。重新啟用時,新配置的 innodb_log_file_size 與舊文件大小不一致,InnoDB 拒絕啟動。

一鍵修復

service mysqld stop
rm -f /var/lib/mysql/ib_logfile*
service mysqld start

若仍失敗

  1. 檢查 datadir 權限(mysql:mysql)
  2. 確認 innodb_log_file_size 配置合理(≤ 2G 總和)
  3. 查錯誤日誌 /var/log/mysqld.log 進一步定位

預防

修改 innodb_log_file_size 後,**必須先停庫、刪舊日誌、再啟動**,否則 100% 報此錯。

copyright © 萬盛學電腦網 all rights reserved