Screaming Loud

日々是精進

The server quit without updating PID fileが発生して起動できない。

YosemiteからEICapitanにアップデートしたんですが、
その際にMySQLが起動できなくなったので、その解決法を共有します。

【環境】
MacOSX 10.11.2
$ mysql --version
mysql Ver 14.14 Distrib 5.6.26, for osx10.10 (x86_64) using EditLine wrapper
brewで入れたやつです)

事象

MySQLサーバを起動しようとすると以下のエラーが出て、起動出来ませんでした。

$ mysql.server restart
 ERROR! MySQL server PID file could not be found!
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/{PC名}.pid).

解決策

mysqld_safeを打つだけ!

mysqld_safeを打つと、エラー発生時の再起動やエラーのロギングなど安全な起動が行われます。
MySQL :: MySQL 5.6 リファレンスマニュアル :: 4.3.2 mysqld_safe — MySQL サーバー起動スクリプト

$ mysqld_safe
160106 10:48:15 mysqld_safe Logging to '/var/log/mysql/error.log'.
touch: /var/log/mysql/error.log: No such file or directory
chmod: /var/log/mysql/error.log: No such file or directory
160106 10:48:15 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
/usr/local/bin/mysqld_safe: line 129: /var/log/mysql/error.log: No such file or directory
/usr/local/bin/mysqld_safe: line 166: /var/log/mysql/error.log: No such file or directory
touch: /var/log/mysql/error.log: No such file or directory
chown: /var/log/mysql/error.log: No such file or directory
chmod: /var/log/mysql/error.log: No such file or directory
160106 10:48:15 mysqld_safe mysqld from pid file /usr/local/var/mysql

mysqlのログディレクトリが無い!と言われたので作ったら動きました。

原因

EICapitanに上げてから、/var/log以下がすっぽり亡くなってました。。
他のScalaから吐き出していたアプリケーションログもお亡くなりに。。