LoginSignup
6
5

More than 5 years have passed since last update.

MySQLが動かなかった時のメモ

Posted at

MySQLをインストールして、いつもの設定をmy.cnfに記述したが動かなかった時のメモ。

#service mysqld start

MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

まずはログ。

tail -f /var/log/mysqld.log

気になる一行発見。

mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
[ERROR] Aborting

取り敢えずmy.cnfの'utf8mb4'を'utf8'に変更で次エラー。

[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

初期テーブルが作成されていないのか、データベースディレクトリがどこだかわからない状態になっているか...。

mysql_install_db --datadir=/var/lib/mysql --user=mysql

これで無事起動できました。

参考:
MySQLをインストールしたけどなかなか起動できない
MySQLをstartしたら[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't existがでたとき

6
5
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5