2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MySQLが起動しない時の対応

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

システムテーブルをアップグレード

mysql_upgrade -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

設定を変更

my.cnf
[mysqld]
skip-grant-tables
mysqld_safe --skip-grant-tables &
mysql -uroot
flush privileges;
grant all privileges on *.* to 'root'@'localhost' with grant option;
flush privileges;
service mysqld stop
service mysqld start

今度はloginできる

mysql -uroot

my.cnfをコメントアウト

my.cnf
[mysqld]
# skip-grant-tables
service mysqld restart
mysql_upgrade -uroot
2
1
0

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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?