connection refused – :econnrefused
PostgreSQL service status
First parameter to cross-check during a psql connection refused error is the status of the PostgreSQL service.
We can confirm this by cross-checking if a Postgres process in running in the server. In a Linux like environment, we can use
ps -ef | grep postgres
service postgresql status
If the service is not running in the server, then we restart it using the command.
service postgresql restart
At times, this failure could be a result of a corrupted Postgresql service. A reinstall of the service with the apt-get install or yum install would be required to fix the issue.
password authentication failed for user “postgres”
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"