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

MysqlでThe server quit without updating PID file エラーについて

Last updated at Posted at 2020-03-29

The server quit without updating PID fileエラー

mysql server startをすると以下のようなエラーが発生
これはmysqlのバージョンを変えたりする時に発生するエラー。つまり別のバージョンのmysqlが動いているので、そちらの実行を止める必要があるということ。

ERROR! The server quit without updating PID file (/usr/local/var/mysql/user-no-MacBook-Air.local.pid).

現在実行中のプロセスを止める必要がある

ps aux | grep mysql  #MySQL関連のプロセス確認

以下のように表示されるので、実行されているプロセスを止める。

user           #これが(31827)PID→#  31827   0.3  0.2  4901664  12920   ??  S    日09PM  22:37.06 /usr/local/Cellar/mysql/8.0.19/bin/mysqld --basedir=/usr/local/Cellar/mysql/8.0.19 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/8.0.19/lib/plugin --log-error=user --pid-file=/usr/local/var/mysql/user.pid
user              31691   0.0  0.0  4271692    672   ??  S    日09PM   0:00.03 /bin/sh /usr/local/Cellar/mysql/8.0.19/bin/mysqld_safe --datadir=/usr/local/var/mysql --pid-file=/usr/local/var/mysql/user.pid
user               3205   0.0  0.0  4277256    812 s001  S+    2:49PM   0:00.00 grep mysql

プロセスの所有権がユーザ名ではない場合は以下を実行して強制的に止める

kill -9 <PID>

これで所有権をとめてから実行する

 mysql.server start

こちらが大変参考になりました。
MySQLエラー解決法(Mac編)
こちらも参考
pidのエラー解決

ちなみにPIDはProsess ID の略

##追記
PIDのプロセスを削除した後

$mysql.server start

を実行しても、既にサーバーは起動しているよというメッセージがでてくる。

$2020-06-04T05:42:53.6NZ mysqld_safe A mysqld process already exists

もう一度pidのプロセスをps aux | grep mysqlで確認すると、
別のプロセスが勝手に起動している!!
なんで??

解決方法

macにはlaunchctlという仕組みがあり,plist定義を作っておくと,自動でデーモンを起動してくれる.これにmysqlが定義されていたらしい(汗)
以下のコマンドでlaunchctlの管理から除外できる.

$brew services stop mysql

参考
https://qiita.com/Komei22/items/31a3db6d5b803ef5082b

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