MySQL5.6がInnoDB書き込み権限エラーで起動に失敗するよ問題 ITかあさん

ITかあさん

MySQL5.6がInnoDB書き込み権限エラーで起動に失敗するよ問題

MySQL5.6がInnoDB書き込み権限エラー

あんたには書き込み権限がないのよ!

あんたには書き込み権限がないっつってんのよ!(バシっ)

そうですか、ないんですか。

まずはMySQLのエラーログチェックして、原因を突き止める

ログの場所を確認

cat /etc/my.cnf

ログチェック!

tail /var/log/mysqld.log

かあさんのMySQLログ

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.
150502 15:53:24 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

1)If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
(パーミッションの問題があるならパーミッションを編集してね)

パーミッション変更

chown -Rf mysql:mysql /var/lib/mysql

再び起動!

# service mysqld start
Starting mysqld: [ OK ]

きたーーーーー!

MySQL5.6使うようになってからパーミッション問題をよく見るなあ

数年前からLAMP環境は当たり前のように作るんですが、MySQL5.6の新しい環境を使うようになってからよくパーミッション問題に悩まされるようになりました。
エラーログを冷静に見て、パーミッションならchownコマンドでパーミッションをmysqlにしてあげようっと。

初夏のJavaScript祭 in サーキュレーションビル ForPro