Running the PostgreSQL CLI (psql) through a bash script as user postgres causes a password prompt to be sent, even though I can run it manually without a password. When I try to put -w in the script, this error occurs:
psql: fe_sendauth: no password supplied
Can I run psql in an automated way without a password?
You can use password file pgpass.conf or use PGPASSWORD variable.
For local development or if security isn’t an issue, you could also configure PostgreSQL to run in trust authentication mode by modifying your
pg_hba.conffile.