pg_hba.conf Authentication
Cheat sheet · https://pcornel.dk/topic.php?topic=6179
Answer
pg_hba.conf controls which clients may connect to PostgreSQL: by connection type, database, user, address and authentication method (scram-sha-256, peer, cert…), first matching line wins.
Remember
Order matters. Use scram-sha-256 rather than md5/trust. Reload after changes (SELECT pg_reload_conf();). The server also needs listen_addresses for remote clients.
First checks
SELECT * FROM pg_hba_file_rules;— first check for this topicpsql -c "SELECT now(), version();"— PostgreSQL reachable and versionmysql -e "SELECT NOW(), VERSION();"— MariaDB/MySQL reachable and versionsqlcmd -S <server> -Q "SELECT @@VERSION"— SQL Server reachable and version
Verify in this order
connection → first matching hba line → auth method → role login
Where it usually breaks
A broad reject or trust rule above your rule changes the result.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6179