2014-03-25 37 views
0

Postgres.app文檔說明了這一點,逐字地說:一旦你的路徑設置正確,你應該可以在沒有主機的情況下運行psql。 (如果沒有,請檢查通過執行哪個psql來正確加載PATH中的版本)這不適合我。應該可以在沒有主機的情況下運行psql Postgres.app

這就是我所在的地方。在沒有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=# 

該文檔明確指出,它應該在沒有localhost的情況下工作。我的設置是否正確?還是需要改變某些內容?上面的代碼讓我覺得所有的東西都能正常工作,但是「應該沒有東道主」的東西讓我不確定。

回答

0

您在使用postgres.apppsql。它的默認配置是從postgres.app連接到數據庫服務器。如果postgres.app未運行,那麼這將不起作用。

在沒有-h的情況下,您必須運行postgres.app

如果你想運行後臺PostgreSQL服務器,postgres.app不是你想要的。從Homebrew安裝或使用EnterpriseDB安裝程序包。

+0

好的,謝謝。那麼爲什麼他們會說「沒有東道主」,他們是什麼意思? – user3138341

+0

它們的意思是*「沒有指定'-h'參數」*,即使用unix套接字。請讓他們使用他們提供的任何文檔反饋選項來改進相關文檔。 –

相關問題