0
0

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 3 years have passed since last update.

mysql が急に壊れた。The server quit without updating PID file エラー

Last updated at Posted at 2021-05-12

結論から言うと

macの再起動で治りました。
それで治る事に気付かずにデータベース削除しちゃったので、忘れないように忘備録。

①pidファイルの作成

ここを参考にしてやってみましたがダメ。

ターミナル
$ touch /usr/local/var/mysql/*****.local.pid
$ sudo chown -R _mysql:_mysql /usr/local/var/mysql/

②DBの削除、再作成

泣く泣く/usr/local/var/mysql も削除しましたがダメ。

ターミナル
$ sudo rm -rf /usr/local/var/mysql
$ brew uninstall mysql
$ brew install mysql

ここでようやく

macの再起動したら治りました笑。
\(^o^)/ DB消しちゃった。

原因はよく分かりませんが、そういえば「システム環境設定」の「共有」のコンピュータ名とか変えたのでそれがよくなかったかも。

phpmyadminに入れない

新しいDBのphpmyadminにrootで入れませんでした。

"The server requested authentication method unknown to the client [caching_sha2_password]"エラー

このエラーがいつ出たか忘れてしまいましたが、とりあえずこれで直しました。

mysql
mysql> SELECT user, host, plugin FROM mysql.user;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'P@ssw0rd';

あとこれも

MySQL5.7以降では、デフォルトでrootユーザーのパスワードが自動で初期設定されるとか。
ここを参考にしてパスワード変えました。

mysql
mysql> set password for root@localhost='新パスワード';

ーーーーーーーーーーーーーーーーーーーーーーーーーーー

参考

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?