postgres:本地主机未连接

day*_*mer 6 postgresql postgresql-9.1

我的postgreSQL.conf样子

\n\n
# - Connection Settings -\n\nlisten_addresses = \'*\'          # what IP address(es) to listen on;\n                                        # comma-separated list of addresses;\n                                        # defaults to \'localhost\', \'*\' = all\n                                        # (change requires restart)\nport = 5432                             # (change requires restart)\n
Run Code Online (Sandbox Code Playgroud)\n\n

我也知道 postgres 正在运行

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

但我无法连接

\n\n
 psql -Uuser -W\nPassword for user user:\npsql: could not connect to server: No such file or directory\n    Is the server running locally and accepting\n    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?\n
Run Code Online (Sandbox Code Playgroud)\n\n

另外,当我运行以下命令时

\n\n
 lsof -i tcp:5432\n \xe2\x9c\x98 me@air11:37:13 \xe2\xae\x80 ~ \xe2\xae\x80 netstat -a | grep postgres\ntcp6       0      0  *.postgres             *.*                    LISTEN\ntcp4       0      0  *.postgresql           *.*                    LISTEN\n
Run Code Online (Sandbox Code Playgroud)\n\n

它说没有运行port 5432\n我错过了什么?

\n\n

更新

\n\n

我的pg_hba.conf样子

\n\n
# TYPE  DATABASE        USER            ADDRESS                 METHOD\n\n# "local" is for Unix domain socket connections only\nlocal   all             all                                     md5\n# IPv4 local connections:\nhost    all             all             127.0.0.1/32            md5\n# IPv6 local connections:\nhost    all             all             ::1/128                 md5\n
Run Code Online (Sandbox Code Playgroud)\n

day*_*mer 1

不知道为什么会发生这种情况,但我发现postgresapp.com很好用

我正在http://www.pgadmin.org/上使用它,到目前为止我运行得很顺利