Windows PSQL命令行:有没有办法允许无密码登录? [英] Windows PSQL command line: is there a way to allow for passwordless login?
问题描述
我的目标是能够启动命令而无需提示输入密码。有什么办法可以从Windows命令行实现这一目标吗?在Linux中,我觉得我可以将密码发送为standard或类似的密码,但是我不确定是否可以在Windows上使用。
谢谢!
有两种方法:
- 设置环境变量PGPASSWORD例如
set PGPASSWORD = yoursecretpassword
- 使用密码文件
%APPDATA%\postgresql\pgpass.conf 文档
中所述的code>
在密码文件中(我的位置是C:\Users\Grzesiek\AppData\Roaming\postgresql\pgpass.conf)使用以doc格式指定。例如,将数据库postgres连接为本地5432服务器上的角色postgres,请添加:
localhost:5432:postgres:postgres:12345
我检查了一下,效果很好(对我而言),但不要使用127.0.0.1)。 / p>
My goal is to be able to fire off a command without having to be prompted for my password. Is there any way to achieve this from the windows command line? In Linux I feel I could send the password to standard in or something, but I am not sure if I could do this for windows.
Thanks!
There are two ways:
- Set environment variable PGPASSWORD e.g.
set PGPASSWORD=yoursecretpassword
- Use password file
%APPDATA%\postgresql\pgpass.conf
as described in documentation
Within password file (my location is C:\Users\Grzesiek\AppData\Roaming\postgresql\pgpass.conf) use specified in doc format. For example to connect database postgres as role postgres on local 5432 server add:
localhost:5432:postgres:postgres:12345
I checked this and it works well (for me), but don't use 127.0.0.1).
这篇关于Windows PSQL命令行:有没有办法允许无密码登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!