MySQL 要從備份還原啟動,但是發生啟動失敗,在 mysql 的 error log 裡面看到下述訊息。
Unable to start MySQL service: Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
InnoDB: Using Linux native AIO
InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: Completed initialization of buffer pool
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Unknown/unsupported storage engine: InnoDB
170122 12:01:00 InnoDB: Warning: table 'mysql/innodb_index_stats' InnoDB: in InnoDB data dictionary has unknown flags 50.
170122 12:01:00 InnoDB: Warning: table 'test/collect' InnoDB: in InnoDB data dictionary has unknown flags 50.
170122 12:01:00 [ERROR] /usr/sbin/mysqld: Table './mysql/user' is marked as crashed and should be repaired
170122 12:01:00 [Warning] Checking table: './mysql/user'
170122 12:01:00 [ERROR] 1 client is using or hasn't closed the table properly
170122 12:01:00 InnoDB: Warning: table 'test/users'
InnoDB: in InnoDB data dictionary has unknown flags 50.
要怎麼修復呢?
MySQL 出現 InnoDB STORAGE ENGINE failed 修復
下述解法取自此篇:Unable to start MySQL service: Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
- vim /etc/my.cnf
innodbfastshutdown=0 - 啟動看看,若還是不行,在加上下述參數
- vim /etc/my.cnf
innodb_log_file_size=5M - 啟動看看,若還是不行,將 ib_logfile0、ib_logfile1 先搬走
- mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile1 /tmp/
- sudo systemctl restart mysql.service # 照理說到這邊應該就可以動了
- 再不行,就把 /var/lib/ib_logfie 都搬走
- mv /var/lib/ib_logfie /tmp/
註:ib_logfile0、ib_logfie1 有什麼用處,可見此篇:在MYSQL中,ib_logfile0,ib_logfile1有什麼用?怎麼打開看?