Ubuntu

無法啟動生產 mysql 伺服器。也沒有日誌消息

  • November 30, 2013

這是我們為客戶管理的生產實例 (EC2)。停機時間已經5小時。我完蛋了。

故事

今天早上我發現我們的一個客戶 mysqld 程序處於終止狀態。我做到sudo service mysql start了,並讓它執行起來。

日誌告知這是由於表崩潰而發生的。在瀏覽了網際網路上的一些參考資料後,我執行了以下命令:

# mysqld was running
$ mysqlrepair -A --auto-repair
$ mysqlrepair -A -o
# By the time the following command was executed, mysqld had stopped
$ mysqlrepair -A -c

於是乎,以下命令拒絕啟動mysqld

$ sudo service mysql start
start: Job failed to start

$ sudo mysqld --verbose
$ ps aux | grep mysql
ubuntu   24124  0.0  0.1   8108   936 pts/0    S+   04:07   0:00 grep --color=auto mysql

$ sudo mysqld_safe
131130 04:09:02 mysqld_safe Logging to '/var/log/mysql/error.log'.
131130 04:09:02 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
131130 04:09:02 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

/var/log/mysql/error.log 中沒有目前時間戳。

$ dmesg | grep mysql
[776212.640137] init: mysql main process (24070) terminated with status 1
[776212.640189] init: mysql main process ended, respawning
[776213.629832] init: mysql post-start process (24071) terminated with status 1
[776213.650730] type=1400 audit(1385784344.772:92): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=24094 comm="apparmor_parser"
[776213.745904] init: mysql main process (24098) terminated with status 1
[776213.745957] init: mysql respawning too fast, stopped

配置文件為: http: //pastebin.com/hbvLGqEM

通過添加到 my.cnf 解決了問題:

innodb_buffer_pool_size = 16M

參考邁克的回答:

https ://askubuntu.com/questions/127264/cant-start-mysql-mysql-respawning-too-fast-stopped

引用自:https://serverfault.com/questions/558340