There are two ways:
- Set environment variable PGPASSWORD e.g.
set PGPASSWORD=yoursecretpassword
- Use password file
%APPDATA%postgresqlpgpass.conf
as described in documentation
Within password file (my location is C:UsersGrzesiekAppDataRoamingpostgresqlpgpass.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).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…