mysql_start_error ~ delete ib_logfile
我們在管理伺服器時常常會遇到各種狀況,本次遇到的狀況也很特殊,MySQL 服務無法啟動,通常新手遇到該狀況也是傻傻的搞不清楚,其實有 log 記錄還好查看,可惜系統管理人員管理的伺服器通常都是交接很多位了,前手是誰根本搞不清楚,IT 的責任常常就是接到任務就要協助去排除問題了( IT 永遠是個最不好當的職業,是條不歸路!! ),好吧,回到問題,當發生該問題時該怎麼辦,檢查 log ?好樣的,我們都知道 linux 可以從/var/log/mysql/去找log,但若是windows環境呢?mysql_error.log? 如果不是呢?查詢 data 料夾底下的 error 字樣的檔案吧,開啟log後會查看到
也有其他說明包含解決的方式
但是該狀況又特殊查詢系統記錄 log 才發現重開機造成的,顧我們至 mysql\data\中找到 ib_logfile0、ib_logfile1、ibdata1三個檔案,將他刪除即可,這三個檔案是種暫存的 cache檔,會去記錄前次關機前所發生的狀況,刪除後 mysql 即可正常開啟服務。
另一個指令也是必備的 mysqld --console 指令,能支援在開機時輸出錯誤訊息。
InnoDB: The log sequence numbers xxxx and xxxx in ibdata files do not match the log sequence number xxxx in the ib_logfiles!
InnoDB: Database was not shutdown normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
但是該狀況又特殊查詢系統記錄 log 才發現重開機造成的,顧我們至 mysql\data\中找到 ib_logfile0、ib_logfile1、ibdata1三個檔案,將他刪除即可,這三個檔案是種暫存的 cache檔,會去記錄前次關機前所發生的狀況,刪除後 mysql 即可正常開啟服務。
另一個指令也是必備的 mysqld --console 指令,能支援在開機時輸出錯誤訊息。
留言
張貼留言