PGPASSWORD
PGPASSWORD is an environment variable used by PostgreSQL client libraries (libpq) to supply a password for authentication without prompting the user. When a client connects to a server and password-based authentication is required, and no password is provided interactively, libpq can read the value of PGPASSWORD and use it as the password.
Usage is straightforward in scripts and automation. On Unix-like systems, you can export PGPASSWORD='secret'; then run
Security considerations are important. PGPASSWORD exposes the credential in the process environment, which can be visible
See also: pgpass (the password file), PGPASSFILE for locating the password file, and libpq documentation on authentication