Home Rails cannot find my Postgres server on Mac OS X / PG::ConnectionBad: could not connect to server
Reply: 0

Rails cannot find my Postgres server on Mac OS X / PG::ConnectionBad: could not connect to server

user934
1#
user934 Published in June 19, 2018, 4:15 pm

I am following a rails tutorial and am trying to do a simple migration but my rails app is having trouble finding my Postgres server (I'm using mac OS X).

When I run bundle exec rake db:migrate on my rails app, I get the following error

PG::ConnectionBad: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

When I type sudo lsof -i tcp:5432 I get the output

COMMAND  PID     USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
postgres  73 postgres    4u  IPv6 0xd0338068e4dc128d      0t0  TCP *:postgresql (LISTEN)
postgres  73 postgres    5u  IPv4 0xd0338068e4852e55      0t0  TCP *:postgresql (LISTEN)

So Postgres is clearly running on port 5432.

What could be the solution?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 1.108666 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO