2

Hi i want to use PostgreSQL for a school project and whenever i open the server in Pg Admin i got the same issue

when i first open Pg Admin i enter the password that i entered in the installation and when i click to server(1) it requires password for user "postgres" i use the same password but it tells me:

could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 1500? 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 1500?

i don't know what does it really mean .. cause i'm new to databases and servers

  • i reinstall all postgres & Pg admin : same issue
  • i restart the server in services-postgres.. : same issue

I'm using PostgreSQL-12 and Pg Admin-4 in Windows-10

image

please help !! and thank you !

toihirhalim
  • 55
  • 1
  • 2
  • 7

4 Answers4

7

On windows:

  • click on windows
  • search for services
  • scroll down to postgresql
  • right-click on it and select properties
  • click on the startup type dropdown button and select automatic
  • then click start
  • this will automatically run your postgresql
Bold
  • 213
  • 1
  • 4
  • 11
1

I am facing the same problem and as I edited the port to 5432 it worked. In my case, Postgres was running on 5433 and I changed it to 5432

saba
  • 43
  • 7
0

Pretty sure the problem is due to this:

... accepting TCP/IP connections on port 1500

Postgres runs by default on port 5432. Try changing the port setting to 5432.

Adrian Klaver
  • 15,886
  • 2
  • 17
  • 28
  • in the postgres config the port is by default 5432. what if i change it to 1500 ? – toihirhalim Jul 11 '20 at 16:23
  • yeeeees !!! i change the port to 1500 and now it's working OMG i'm verry happy now :) – toihirhalim Jul 11 '20 at 16:25
  • Why not leave it at the default port(5432) and change the port setting in the connection setting? Most Postgres clients are going look for 5432 by default and you will need to change that to 1500 for each. – Adrian Klaver Jul 11 '20 at 16:31
  • well i'm just gonna use it for now for my project and then i will change it for future work – toihirhalim Jul 11 '20 at 16:44
  • Yeah well temporary fixes often turn into permanent ones. If it where me I would make the change now to save the hassle of undoing/maintaining it in the future. – Adrian Klaver Jul 11 '20 at 16:48
  • hhh you're right Adrian ! but i have 3 project to finish in 5 days and as a beginner what really matter for now is the projects to work and then after configuration . but thank you tho for your advice ! – toihirhalim Jul 11 '20 at 16:55
0

For me the issue is due to not starting a server, so you should start the server, one way to do it is to cd to postgresql bin and start it with pg_ctl, here is an example:

cd "C:\Program Files\PostgreSQL\14\bin"
pg_ctl -D "C:\Program Files\PostgreSQL\14\data" start
DINA TAKLIT
  • 7,074
  • 10
  • 69
  • 74