[Solved]: Could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5433?

You may be trying to connect to the wrong port. Standard port is 5432

Solution changing postgresql’s config file

Step 1: The solution is changing the port in the configuration of updated postgresql (9.5). To do this open the file

 /etc/postgresql/9.5/main/postgresql.conf 

Step 2: Change the line

port = 5433                     # (change requires restart)

to

port = 5432                     # (change requires restart)

Step 3: Restart the server with

sudo service postgresql restart.