Troubleshooting·PostgreSQL
PostgreSQL Password Authentication
A remote client with the right password is still refused - because no pg_hba rule covers it. The error names the host, the role and the database, and changing any one of the three changes the outcome.
Roles and Authentication Guide 17 of 47 Intermediate
- OSUbuntu 26.04 LTS
- PostgreSQL18.6-0ubuntu0.26.04.1
- Authscram-sha-256
- TimeAbout 16 min
scram-sha-256 is the default since PostgreSQL 14 and is what CREATE ROLE ... PASSWORD stores. The older md5 method is still accepted in pg_hba.conf and should not be used for anything new.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| db-a01 | 192.168.0.81 | Ubuntu 26.04 LTS | Primary / Source / Replica Set Member 1 | 2 Core | 4 GB | 50 GB |
| db-util01 | 192.168.0.84 | Ubuntu 26.04 LTS | Client, Backup Target and Monitoring | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when a remote client has the right password and is still refused. This matters because the password is never even reached - no pg_hba.conf rule matched, and the error names precisely what was missing.
- confirming the server is reachable at all, once
listen_addressesis opened - connecting with the correct password, and being refused regardless
- adding exactly the rule the error complained about
- changing the password and then the database, and telling those two failures apart
Before you start
listen_addressesset to accept network connections.- A second host with
postgresql-clientinstalled.
-
Confirm the server is reachable at all
-
Connect with the correct password, and be refused
-
Add exactly the rule that was missing
-
Change the password, and then the database