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