Irwan
Irwan

Reputation: 583

PG Error Connection on Mac

I am using PG for my Rails application, but suddenly today I can't access my application with this error :

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? could not connect to server: Connection refused Is the server running on host "localhost" (fe80::1) and accepting TCP/IP connections on port 5432?

I already tried some ways to fix it, but it doesn't work.

I tried to check with Irwans-MacBook-Pro:starterpad2 blackaholic$ ps auxwww | grep postgres

postgres        13342   0.0  0.0  2471272   1072   ??  S    Fri04PM   0:04.50 /usr/sbin/cfprefsd agent
postgres        68867   0.0  0.0  2619716   2640   ??  Ss   17May15   0:00.10 postgres: postgres starterpad ::1(60748) idle 
postgres          937   0.0  0.0  2469216    120   ??  S     8May15   0:08.83 /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdflagwriter
postgres          270   0.0  0.0  2474500    140   ??  Ss    8May15   0:00.03 postgres: logger process    
blackaholic     53913   0.0  0.0  2451204    684 s003  S+   10:28AM   0:00.00 grep postgres

And when I check if the server run or not :

> pg_ctl -D /usr/local/var/postgres status
pg_ctl: no server running

Anyone know why this is happen? I already tried to restart my PG server, but it's keep saying that no server running.

Upvotes: 0

Views: 47

Answers (1)

Jimmy Baker
Jimmy Baker

Reputation: 3255

Did you install it using homebrew? If not, you will probably have better luck doing so.

> brew install postgres

Once it finishes installing you will see instructions on how to start/stop it. Don't forget to run

> createdb

to install your user specific database. Once that's done you should be good to go.

Upvotes: 1

Related Questions