PostgreSQL Debugging#
When PostgreSQL breaks, it usually falls into a handful of patterns. This is a reference for diagnosing each one with specific queries and commands.
Connection Refused#
Work through these in order:
1. Is PostgreSQL running?
sudo systemctl status postgresql-162. Is it listening on the right address?
ss -tlnp | grep 5432If it shows 127.0.0.1:5432 but you need remote access, set listen_addresses = '*' in postgresql.conf.
3. Does pg_hba.conf allow the connection? Check logs for no pg_hba.conf entry for host: