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

「ERROR! The server quit without updating PID file」のエラー解消

Posted at

macの再起動後に起こったエラー
自分でmysqlのバージョンを変えるコマンドを打ったことにより起こったエラー
この二つの合わせ技

なかなか解決に至る記事が見つからなかったのでここに書く
履歴を辿ってもその記事にたどり着けない不思議
理屈も何もないコマンドと結果のみ

$ chown username /usr/local/var/mysql/***.local.err

おそらくこのコマンドの後に

$ mysql.server start

で、直った。以下は軌跡

ERROR! The server quit without updating PID file

$ mysql.server start
Starting MySQL
.Logging to '/usr/local/var/mysql/***.local.err'.
ERROR! The server quit without updating PID file (/usr/local/var/mysql/***.local.pid).
$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
$ touch /tmp/mysql.sock
$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (38)
$ mysql.server start
Starting MySQL
.Logging to '/usr/local/var/mysql/***.local.err'.
ERROR! The server quit without updating PID file (/usr/local/var/mysql/***.local.pid).
$ bundle exec rails s
can't connect to local mysql server through socket '/tmp/mysql.sock' (38)

Gem::Ext::BuildError: ERROR: Failed to build gem native extension

$ bundle exec gem uninstall mysql2
Successfully uninstalled mysql2-0.5.2
$ bundle install
Installing mysql2 0.5.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

$ chown username /usr/local/var/mysql/***.local.err

$ chown username /usr/local/var/mysql/***.local.err
$ bundle install
installing mysql2 0.5.2 with native extensions
Bundle complete! 23 Gemfile dependencies, 81 gems now installed.
Bundled gems are installed into `./vender/bundle`

bundle install成功

can't connect to local mysql server through socket '/tmp/mysql.sock' (38)

$ bundle exec rails s
Mysql2::Error::ConnectionError (Can't connect to local MySQL server through socket '/tmp/mysql.sock' (38)):

エラーは変わらない

$ touch /usr/local/var/mysql/***.local.pid

$ mysql.server restart
ERROR! MySQL server PID file could not be found!
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/***.local.pid).
$ touch /usr/local/var/mysql/***.local.pid
$ sudo mysql.server restart
ERROR! MySQL server PID file could not be found!
Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/***.local.pid).

初めはmysql.server startで、エラーが起こっていたのでリスタートにしていたが、スタートで成功

$ touch /usr/local/var/mysql/***.local.pid
$ mysql.server start
Starting MySQL
.. SUCCESS! 

理解した都度に更新していきます。ご容赦あれ

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