简体   繁体   English

应该能够在没有主机Postgres.app的情况下运行psql

[英]Should be able to run psql without host Postgres.app

Postgres.app documentation says this, verbatim: Once your path is correctly set up, you should be able to run psql without a host. Postgres.app文档一字不漏地说:一旦正确设置了路径,就应该能够在没有主机的情况下运行psql。 (If not, check that the correct version is being loaded in the PATH by doing which psql) This is not so for me. (如果不是,请通过执行哪个psql来检查PATH中是否加载了正确的版本)。

Here's where I'm at. 这就是我的位置。 WITHOUT the Postgres.app on (No elephant anywhere): 在不使用Postgres.app的情况下(任何地方都没有大象):

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

This is correct, and what Heroku says to look for. 这是正确的,而Heroku说的是要寻找的内容。 Heroku also tells me the command below should work, but it doesn't: 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?

however I can get it to work when I double click postgres.app and turn it on. 但是,当我双击postgres.app并将其打开时,我可以使它工作。

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

johncurry=#

The docs specifically say that it should work WITHOUT the localhost. 该文档专门说它应该在没有本地主机的情况下工作。 Am I set up correctly or do I need to change something? 我设置正确还是需要更改某些内容? The code right above makes me feel like everything is working properly, but the "should work without a host" thing makes me unsure. 上面的代码使我觉得一切正常,但是“没有主机就应该工作”让我不确定。

You're using the psql from postgres.app . 您正在使用来自postgres.apppsql It's configured to, by default, connect to the database server from postgres.app . 默认情况下,它已配置为从postgres.app连接到数据库服务器。 That won't work if postgres.app is not running. 如果postgres.app没有运行,那将不起作用。

With our without -h , you must have postgres.app running. 如果没有-h ,则必须运行postgres.app

If you want to run a background PostgreSQL server, postgres.app isn't what you want. 如果要运行后台PostgreSQL服务器,则不需要postgres.app Install from Homebrew or use the EnterpriseDB installer packages. 从Homebrew安装或使用EnterpriseDB安装程序包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM