postgresqlpostgresql-9.1

postgres: localhost not connecting


My postgreSQL.conf looks like

# - Connection Settings -

listen_addresses = '*'          # what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost', '*' = all
                                        # (change requires restart)
port = 5432                             # (change requires restart)

and I also know that postgres is running

air:data postgres$ ps -aef | grep postgres
  504 16474 16473   0 11:34AM ??         0:00.00 postgres: logger process
  504 16476 16473   0 11:34AM ??         0:00.00 postgres: writer process
  504 16477 16473   0 11:34AM ??         0:00.00 postgres: wal writer process
  504 16478 16473   0 11:34AM ??         0:00.00 postgres: autovacuum launcher process
  504 16479 16473   0 11:34AM ??         0:00.00 postgres: stats collector process
    0 16087 16078   0 10:54AM ttys001    0:00.03 su - postgres
  504 16473     1   0 11:34AM ttys001    0:00.22 /Library/PostgreSQL/9.1/bin/postgres -D/Library/PostgreSQL/9.1/data
  504 16484 16088   0 11:34AM ttys001    0:00.00 grep postgres

But I am not able to connect

 psql -Uuser -W
Password for user user:
psql: 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"?

Also, when I run the following

 lsof -i tcp:5432
 ✘ me@air11:37:13 ⮀ ~ ⮀ netstat -a | grep postgres
tcp6       0      0  *.postgres             *.*                    LISTEN
tcp4       0      0  *.postgresql           *.*                    LISTEN

It says nothing running on port 5432 What am I missing?

UPDATE

My pg_hba.conf looks like

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

Solution

  • Not sure why this was happening, but I found postgresapp.com which is pretty good to use

    I am using this with http://www.pgadmin.org/ and I am running it smoothly so far