psql 带上密码

Posted 水天需

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了psql 带上密码相关的知识,希望对你有一定的参考价值。

postgresql-scripting-psql-execution-with-password

The obvious way is via the password prompt
Instead of that, you can...
provide the password in a pgpass file or through the PGPASSWORD environment variable.

See these:

Command-line There is no option to provide the password as a command line argument because that information is often available to all users, and therefore insecure. However, in Linux/Unix environments you can provide an environment variable for a single command like this:
PGPASSWORD=yourpass psql ...psql -h 192.168.1.8 -p 5432 -U lg -d mydb -c "select * from myschema.table"

以上是关于psql 带上密码的主要内容,如果未能解决你的问题,请参考以下文章

如何以非交互方式为“psql”指定密码?

psql:致命:用户 windows 8 的密码验证失败

克隆码云中的项目的时候如何带上密码

linux中scp文件怎么带上密码

git clone私人仓库时自动带上帐号密码验证

git clone私人仓库时自动带上帐号密码验证