PostgreSQL accepting TCP/IP connections on port 5432?

Just a short post for anyone who is having this particular error,

PostgreSQL service not running
PostgreSQL service not running
Failed to connect to the database: could not connect to server:
Connection refused
Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?
could not connect to server: Connection refused. 
Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

We received this error when we created a new user account(KL) in Kali Linux to run as, rather than use the root account.

The reason for getting this error is that the service PostgreSQL is not running on the box. So all we have to do is to start the PostgreSQL and Metasploit services.

sudo service postgresql start; sudo service metasploit start
Start services PostgreSQL and Metasploit
sudo service postgresql start
sudo service metasploit start

To avoid having to type this in every time you reboot the box, you can just have those two services startup at boot.

Configure PostgreSQL and Metasploit to start on startup

sudo update-rc.d postgresql enable
sudo update-rc.d metasploit enable

One thought on “PostgreSQL accepting TCP/IP connections on port 5432?

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you sure you are human? *