4

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

4
  • 2
    "Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?" - so what is the answer to that question? Commented Sep 27, 2014 at 22:06
  • 1
    Also, do you have a 3rd party firewall installed on the computer? they can cause issues if they attempt to filter local loopback traffic. That's a stupid thing to do, but many 3rd party firewalls are exactly that - pretty stupid. Commented Sep 28, 2014 at 1:27
  • thanks for taking the time to look at my question. I figured it out. Started the server Commented Sep 28, 2014 at 2:52
  • Isnt pgadmin supposed to start the server when it starts? Why do i have to start it manually from the folder? Any idea? Commented Sep 28, 2014 at 3:09

5 Answers 5

11

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

Sign up to request clarification or add additional context in comments.

Comments

4

Start the server with postgres -D ['data folder']

As in docs:

http://www.postgresql.org/docs/9.1/static/server-start.html

So in my Windows postgres installation from the bin folder:

postgres.exe -D ..\data

where data is in the postgresql installation folder

2 Comments

To run in background use: pg_ctl.exe start -D ..\data
if you get error service manager not starting: open command window in administrator mode. then run pg_ctl register -N "Postgres server" -D ..\data -s auto . This will start postgres as a service on start of computer
1

I had the same issue like Venkatesh had. But in my case I had installed pgadmin in version 9. But also installed version 12 at the same time.

When I now uninstalled version 9, the port was already set in the config of version 12 and not given free.

So my solution was to change the port of version 12 in the postgresql.conf file. Or even simplier, change the port in the server creation from 5432 to 5433. Now you are able to create a server again.

Comments

0

I got this same error. This happened when I uninstall and re-install postgress, for some reason after second-time installation, pgadmin tries to connect to the server on port 5433 whereas the server is running on 5432.

Rightclick server properties and change the port to 5432 and try to connect again. It should work now.

Comments

0

Your server running on port 5432 but in the properties, the port is set to 5433.

You must go to pgAdmin, click on database version, ex: PostgresSQL 10 and edit properties.

A new window appears and you need to change the port to 5432 [this is default port].

Hope this helps.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.