me show you the step to fix this error.
Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections
This can happen due to following 2 reason
- Your Firewall is blocking postgresql from making connection.
- You have not configured your postgresql database on the server to accept connection from particular machines on the network
# iptables -A INPUT -s 0.0.0.0/0 -p udp --dport 5432 -j ACCEPT
Look out for this line
listen_addresses = 'localhost'
and change it to
listen_addresses = '*'
Stopping postgresql service: [ OK ]
Starting postgresql service: [ OK ]