How to Fix Could Not Connect to Server PostgreSQL

Common Causes

Check Service

sudo systemctl status postgresql

Verify Port

netstat -an | grep 5432

Check pg_hba.conf

Ensure client IP is allowed in pg_hba.conf configuration.