公司內部服務器,突然斷電,造成無法啟動的解決辦法
把my.cnf中配置的datadir路徑下的ib_logfile* (比如ib_logfile0, lb_logfile1....)文件移到另外一個目錄中, 備用
然后再/etc/init.d/mysql start,或者其它啟動方法 /usr/bin/mysqld_safe & 等啟動,
檢查是否正確啟動!
以下是檢查過程------------------------------############################################
root@1399cx:/home/gm# /etc/init.d/mysql start
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql start
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start mysql
start: Job failed to start
root@1399cx:/home/gm# /usr/bin/mysqld_safe -uroot &
[1] 4236
root@1399cx:/home/gm# 140303 17:02:53 mysqld_safe Logging to syslog.-------------------錯誤日志記錄到此處.
輸入命令: locate syslog
得知syslog在/var/log/目錄下,即/var/log/syslog
輸入命令 : tail -n 40 /var/log/syslog
顯示以下錯誤日志
--------------------
Error: log file ./ib_logfile0 is of different size 0 5242880 bytes----------------------google了一下 這個錯誤,
得知,把日志文件移動其它目錄下,也許可以正常啟動mysql
---------------------------------
立馬移動日志
我的日志文件在/home/mysql_dir下
輸入命令: cd /home/mysql_dir
輸入命令: mv lb_logfile* /home/bakdir #備份日志文件到其它目錄
輸入命令: /etc/init.d/mysql start #啟動mysql
--------------------------#################################################------------
稍等片刻,mysql終於啟動了....好興奮....