2
2

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.

Railsで「TCP/IP connections on port 5432」のエラーが出てサイトが見られない。

Posted at

昨日、Terminal上で正常にRailsを終了させずシステム終了した。
翌朝、起動した際にエラーが出た。

PG::ConnectionBad at /
could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?

作業できない。困った。
error.jpg

普通にpostgresqlを再起動すると
FATAL: lock file "postmaster.pid" already exists
と言われる。

○正常終了しなかったためにpidファイルが残っているのが原因

手順
1:pidファイルの削除
2:postgresqlの再起動
ーーーーーーーーーーーーーーーーーーーーーーーーーーーー
1:pidファイルの削除

find /usr/local/var/postgres/postmaster.pid
→ファイルがあるか確認

rm /usr/local/var/postgres/postmaster.pid
→pidファイルの削除
ーーーーーーーーーーーーーーーーーーーーーーーーーーーー
2:postgresqlの再起動

brew services stop postgresql
→postgresql 終了

brew services start postgresql
→postgresql 再起動
ーーーーーーーーーーーーーーーーーーーーーーーーーーーー

直った。よかった。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?