LoginSignup
0
0

More than 3 years have passed since last update.

PCが落ちてRailsがposgreSQLにつながらない 解決策

Posted at

Rails でPG::ConnectionBad のエラーの解決方法

Macbook pro でスクールのrailsの課題を勧めていたらパソコンが落ちてしまった。PCを再起動してRails をターミナルで起動させようとしようとおなじみの以下を入力

% rails s

chromeでlocalhost:3000につなげてみると画像のようなエラーが発生した。
スクリーンショット 2020-08-20 19.29.23.png
SQLが停止していると思い

% brew services start postgresql

を行ったみたものの

Service `postgresql` already started, use `brew services restart postgresql` to restart.

なので

% brew services restart postgresql

を実行してみたものの、全く変化なし。
英語のサイトを参照

https://stackoverflow.com/questions/13410686/postgres-could-not-connect-to-server

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

実行したらうまく行った😊 1時間かかりましたが解決してよかった。もし同じようなエラーで困っている方がいたら参考にしてください。
posgreを正常に停止させないと出てくるエラーらしいです。

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