LoginSignup
84
70

More than 3 years have passed since last update.

PostgresSQL のerror Postgres PG::ConnectionBad: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Last updated at Posted at 2018-01-05

環境

  • macOS High Sierra
  • psql (9.6.4)
  • homebrew でpostgresをinstallした
  • 一応Railsでつかっています。

結論

$ brew services start postgresql
$ brew services stop postgresql
$ brew services restart postgresql

brewでinstall したものの再起動のしかたを学びました。
これは他のbrewでinstallしたものにもつながるかもしれませんん!

流れ

急になぜか、下記のようなエラーがでてpsqlが起動しなくなってしまいました。

PG::ConnectionBad: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

この辺にかかれている
https://qiita.com/ms2sato/items/a0f7d32a3ecda76a7be3

rm /usr/local/var/postgres/postmaster.pid

を試すもうまくいかず。

ここに書かれている
https://qiita.com/lasershow/items/aa8025379edda760dad8

rm  -rf /usr/local/var/postgres/postmaster.pid
initdb /usr/local/var/postgres

をやろうかなって思いましたが、DBが初期化されてしまうようなので、もう少ししらべようかなと。

すると

この方のブログにありました。

twitterもフォローよろしくおねがいします。 !

84
70
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
84
70