0

Postgres.app 文档逐字逐句地说明了这一点:正确设置路径后,您应该能够在没有主机的情况下运行 psql。(如果没有,请通过执行 which psql 检查是否在 PATH 中加载了正确的版本)这对我来说不是这样。

这就是我所在的地方。没有 Postgres.app (任何地方都没有大象):

$ which psql
/Applications/Postgres.app/Contents/Versions/9.3/bin/psql

这是正确的,也是 Heroku 所说的要寻找的东西。Heroku 还告诉我下面的命令应该可以工作,但它没有:

$ psql -h localhost
psql: 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" (fe80::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?

但是,当我双击 postgres.app 并打开它时,我可以让它工作。

$ psql
psql (9.3.3)
Type "help" for help.

johncurry=#

文档特别说它应该在没有本地主机的情况下工作。我设置正确还是需要更改某些内容?上面的代码让我觉得一切正常,但“应该在没有主机的情况下工作”让我不确定。

4

1 回答 1

0

您正在使用psqlfrom postgres.app。默认情况下,它配置为从postgres.app. postgres.app如果没有运行,那将不起作用。

有了我们的 without -h,你一定有postgres.app跑步。

如果你想运行一个后台 PostgreSQL 服务器,postgres.app那不是你想要的。从 Homebrew 安装或使用 EnterpriseDB 安装程序包。

于 2014-03-25T00:30:39.950 回答