状況
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"?
原因
- postgresqlが動いていなかった
上のように $ psql
を打ったときに「psql: could not connect to server: Connection refused」と出たのでpostgresqlが動いていないことがわかる。
対処
-
$ sudo service postgresql start
を実行する -
$ rails s -p $PORT -b $IP
を実行する