今天啓動MySQL 時發現啓動不了,通過在/etc/init.d/mysqld中找到
get_mysql_option mysqld_safe log-error "/var/log/mysqld.log"行即找到log所在處。 在 /var/log/mysqld.log 中發現以下問題:
100605 11:26:23 [Note] Plugin 'ndbcluster' is disabled.
100605 11:26:23 InnoDB: Started; log sequence number 0 44253
/usr/libexec/mysqld: File './mysql-bin.000012' not found (Errcode: 2)
100605 11:26:23 [ERROR] Failed to open log (file './mysql-bin.000012', errno 2)
100605 11:26:23 [ERROR] Could not open log file
100605 11:26:23 [ERROR] Can't init tc log
100605 11:26:23 [ERROR] Aborting
100605 11:26:23 InnoDB: Starting shutdown...
100605 11:26:28 InnoDB: Shutdown completed; log sequence number 0 44253
100605 11:26:29 [Note] /usr/libexec/mysqld: Shutdown complete
100605 11:26:29 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
原來是把mysql-bin.oooo12這個最新的日誌給刪除拉的緣由。
解決方法就是 gedit /etc/my.cnf 中註釋掉log-bin=mysql-bin 如今查看log則有: 100605 12:05:57 mysqld_safe Starting mysqld daemon with databases from /home/data/mysql 100605 12:05:57 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead. 100605 12:05:57 [Note] Plugin 'ndbcluster' is disabled. 100605 12:05:57 InnoDB: Started; log sequence number 0 44253 100605 12:05:57 [Note] Event Scheduler: Loaded 0 events 100605 12:05:57 [Note] /usr/libexec/mysqld: ready for connections. Version: '5.1.46' socket: '/home/data/mysql/mysql.sock' port: 3306 Source distribution