Databases · Database Troubleshooting
Connection Refused and Timeouts
Cheat sheet · https://pcornel.dk/topic.php?topic=6194
Answer
Connection refused means nothing listens on that address/port (or it rejects); timeout means packets are dropped (firewall, routing) or the server is overloaded.
Remember
Check listening address (localhost only?), port, firewall, and the server's connection limit. Then authentication.
First checks
nc -vz <host> <port>— 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
client → DNS → TCP to port → server accepts → auth
Where it usually breaks
A server listening only on 127.0.0.1 refuses remote connections.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6194