我安装了 Postgres.app,当我打开它时,菜单栏图标显示“在端口 5432 上运行”。但是,当我单击“打开 psql”菜单选项时,我看到以下消息:
/Applications/Postgres.app/Contents/MacOS/bin/psql ; exit;
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
logout
[Process completed]
有什么想法吗?
最佳答案
它很可能在不同的位置,有几种方法可以解决这个问题。
- 连接时使用 tcp 而不是 unix 套接字 (
-h localhost
) - 在连接时指定正确的套接字(您可以使用:
netstat -ln | grep PGSQL
) - 通过修改 postgresql.conf 和更改
unix_socket_directory
变量来更改套接字的位置。
关于postgresql - Postgres.app 显示 "Running on Port 5432"但 psql 命令失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16878784/