简体   繁体   中英

Running psql directly

I have psql at the following location:

$ /Applications/PostgreSQL/psql.app 

When I double click the app icon, it runs the following command and opens it:

$ cd /Users/david/PostgreSQL/pg94;source pg94.env;bin/psql
Password: 

It will then allow me to enter in the psql shell:

psql (9.4.18)
Type "help" for help.

postgres=# 

How would I add this to my path so I can just type in psql and it will go directly into the shell? I have tried a few of the other answers, but they don't seem to help.

As a workaround, now I have just done:

alias psql="cd /Users/david/PostgreSQL/pg94;source pg94.env;bin/psql"

But is there a cleaner way to do this?

添加以下路径对我有用:

export PATH="/Users/david/PostgreSQL/pg94/bin:$PATH"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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