Running postgreSQL 13.2 with ssl on.
I need to connect to a database from a third party application that requires a connection URI, but it is not working. So I tested connecting with psql using two different formats with the same credentials. One worked and one didn’t.
The following command logs me into mydb as user myuser:
# psql -U myuser -d mydb -h 127.0.0.1 -p 5432 -W Password: psql (13.2 (Debian 13.2-1.pgdg100+1)) SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off) Type "help" for help. mydb=>
However this command fails:
# psql postgresql://myuser:MYPASSWORD@127.0.0.1:5432/mydb?sslmode=require psql: error: FATAL: password authentication failed for user "myuser"
I am using exactly the same credentials. I’ve verified it more than 10 times. Removing “sslmode=require” does not fix the problem.
My pg_hba.conf file contains:
host mydb myuser 127.0.0.1/32 password
I made it the first line in my pg_hba.conf file, so it can’t be getting hung up on any other line.
What am I doing wrong?