Home > Net >  psql doesn't prompt for password and throws wrong password error (PostgreSQL 15 / Windows 10)
psql doesn't prompt for password and throws wrong password error (PostgreSQL 15 / Windows 10)

Time:11-18

I'm trying to use PostgreSQL on my desktop at work (Windows 10). When installing, everything goes fine and I set a password to the default postgres user.

Using psql -U postgres on PowerShell, it throws this error message BEFORE prompting me to enter a password:

psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL:  password authentication failed for user "postgres"

In the pg_hba.conf file, all METHOD values are set to scram-sha-256. Changing to md5 and password doesn't help. It only works when I change it to trust, but wanted to have a password. How can I fix this?

CodePudding user response:

add -W flag to force prompt for password https://www.postgresql.org/docs/devel/app-psql.html

  • Related