LoginSignup
0
0

More than 3 years have passed since last update.

Postgresエラー「PG::ConnectionBad」

Posted at

 何度もつまづいたので一旦簡単にメモ

PG::ConnectionBad

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

スクリーンショット 2020-09-10 22.17.38.png

% postgres -D /usr/local/var/postgres
2020-09-10 22:13:34.167 JST [8631] FATAL:  lock file "postmaster.pid" already exists
2020-09-10 22:13:34.167 JST [8631] HINT:  Is another postmaster (PID 494) running in data directory "/usr/local/var/postgres"?
% rm /usr/local/var/postgres/postmaster.pid

rmでpostmaster.pidを削除
  

% brew services restart postgresql

リスタートしてあげる。

  

% rails s

起動して確認

ポイント

postmaster.pidが残っていること
正常にpostgresqlが終わらせられていないと
postmaster.pidというファイルが残ってしまった結果
接続できない起動できないエラーが発生するみたいです。

もう少し詳しく調べて再度更新予定。
postgresqlの起動と停止についての仕組みをしる必要がありそう
今回はメモまで。

参考記事

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