Help us understand the problem. What is going on with this article?

rails s -p $PORT -b $IPするとPG::ConnectionBadが出たとき

More than 3 years have passed since last update.

状況

PG::ConnectionBad
could not connect to server: Connection refused Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Screenshot_1.png

原因

  • postgresqlが動いていなかった

Screenshot_2.png

上のように $ psql を打ったときに「psql: could not connect to server: Connection refused」と出たのでpostgresqlが動いていないことがわかる。

対処

  1. $ sudo service postgresql start を実行する
  2. $ rails s -p $PORT -b $IP を実行する

Screenshot_3.png

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away