day*_*mer 6 postgresql postgresql-9.1
我的postgreSQL.conf样子
# - 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)\nRun Code Online (Sandbox Code Playgroud)\n\n我也知道 postgres 正在运行
\n\nair: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\nRun 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"?\nRun 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\nRun Code Online (Sandbox Code Playgroud)\n\n它说没有运行port 5432\n我错过了什么?
更新
\n\n我的pg_hba.conf样子
# 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\nRun Code Online (Sandbox Code Playgroud)\n