2015-01-06 49 views
-2

每當我嘗試運行psql本地即$ psql -d template1 -U postgres我收到-bash: psql: command not found無法運行的Postgres(PSQL)本地

我已經安裝Postgres的Mac應用程序,但是當我點擊打開psql裏我得到...

Last login: Tue Jan 6 16:30:17 on ttys001 
admins-MacBook-Air:~ surajkapoor$ /Applications/Postgres.app/Contents/MacOS/bin/psql ; exit; 
psql: FATAL: database "surajkapoor" does not exist 
logout 

[Process completed] 

這對我沒有意義。我假設在本地安裝mac應用安裝postgres。

+0

爲什麼你指定需要的參數使用'psql'時,而不是當使用工具的完整路徑? –

回答

2

您需要添加在PSQL文件是MAC的PATH變量這將是

/Applications/Postgres.app/Contents/MacOS/bin/ 

開幕PSQL不帶參數都將嘗試與當前用戶名連接到數據庫的目錄如果你不希望將目錄添加到PATH變量你可以把整個地址在控制檯上,它應該工作

/Applications/Postgres.app/Contents/MacOS/bin/psql -d template1 -U postgres