Many a times you will find that following error is showing while connecting to the postgres server from a different host/IP.
Error: psql: could not connect to server: Connection refused Is the server running on host "X.X.X.X" and accepting TCP/IP connections on port 5432?
postmaster or PostgreSQL’s server daemon process is not running or postgresql.conf settings are not configured properly.
- Check whether postgres service is running or not. Use link to get all the commands for the same. Or access following page.
2. If your service is up and running fine then the error is due to not having PostgreSQL configured to allow TCP/IP connections or at least not connections from your particular workstation. Check the following parameters.
postgresql.confnot setup to allow TCP/IP connections. You’ll want to look at the
postgresql.confis not setup to allow connections on a non-standard port number. To determine this look at the
- authentication rules in PostgreSQL’s access configuration file (
pg_hba.conf) are not setup to allow either your uses or IP address to connect to that database.
- ensure that there are no firewalls, such as
iptablesthat are keeping your local system from even establishing a connection to the remote host