Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgresql refusing connection to server

I have been trying to connect to my postgresql 9.3 server but I keep getting this error.

Server doesn't listen
The server doesn't accept connections: the connection library reports 
could not connect to server: Connection refused (0x0000274D/10061) 
Is the server running on host "localhost" (::1) and accepting TCP/IP 
connections on port 5433? could not connect to server: Connection     
refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) 
and accepting TCP/IP connections on port 5432? 

I have tried connecting through pgadmin3 and the command line.

psql.exe -h localhost -U postgres

This command also gives the same error.

I am on a windows machine. I have tried creating a separate server also with the same result.

I have no idea whats happening. Please help.

Thanks

like image 665
sushmit sarmah Avatar asked Dec 15 '22 19:12

sushmit sarmah


1 Answers

As the error clearly tells or asks actually, Is the server running on host "localhost"? So the chances are, the Postgres server is not running on your machine.

You can start the service(the layman way) by going to services and starting the service.

Here is how you do it:

  • Open Run Window by Winkey + R
  • Type services.msc
  • Search Postgres service based on the version installed.
  • Click stop, start or restart the service option.

How to start Postgres server on windows machine

like image 180
Shri Avatar answered Dec 26 '22 03:12

Shri