psql: error: connection to server at "localhost" - postgresql

Let me first mention I don't have admin privilege on my PC, So I could not install PostgreSQL with the normal process. I just download the binary files from here enterprisedb.com/download-postgresql-binaries,
and added it to environment variable paths.
My problem when I try to start a new server from pgAdmin it gives me the below error.
connection to server at "localhost" (::1), port 5432 failed: Connection refused
(0x0000274D/10061) Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
(0x0000274D/10061) Is the server running on that host and accepting TCP/IP connections?
I searched a lot for a solution
The first recommendation I got is to restart postgress from windows services but I couldn't find it.
Second recommendation was to edit the psogress config file but also I can't find it at all they say that I can find it in the main directory of postgress.

Related

Issue when accessing PostgreSQL 15 in pgAdmin4

Getting the following error when trying to access PostgreSQL 15 in pgAdmin 4 for the first time. Is this because I've messed up the passwords?
Error message: connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? connection to server at "localhost" (::1),port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections?
Any advice on solutions/ next steps would be ideal!

Can't connect to database PostgreSQL14. Can't start PostgreSQL on Windows services

When I starting to connecting, I catch error:
psql: error: connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061)
Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (0x0000274D/10061)
Is the server running on that host and accepting TCP/IP connections?
PostgreSQL can't start on Windows services. (On my PC installed Win10)
This solution didn't help - https://stackoverflow.com/a/27568135/17655569
Also I tried reinstall with this instruction (https://webkul.com/blog/postgresql-windows-installation-problem-running-post-install-step-installation-may-not-complete-correctly/), unfortunately, this method help before the first computer reboot
Maybe anybody occurred with the same problem?

Cannot connect postgreSQL server to pgAdmin 4

I know there are a lot of similar questions on this site, but so far I've been unable to find any answers. I have a postgres 13 server running on a WSL distro, ubuntu 20.04. I am trying to connect a gui to the server. I've tried Postbird and pgAdmin 4, both give me a similar error:
'Unable to connect to server:
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
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?'
Steps I have tried:
I can connect to the server inside of ubuntu by running psql.
I have changed the postgresql.conf file to include listen_addresses = '*'
I have modified the pg_hba.conf file to look like:
pg_hba.conf
I have confirmed that the server is indeed running on port 5432.
Thanks for reading. Any advice would be greatly appreciated.
Ok! So my issue was indeed the pg_hba.conf file. I had to add a line at the bottom
host all all 0.0.0.0/0 trust
Once I did that, I restarted my server and was able to connect.

What can prevent me from making remote access to postgresql?

I'm trying to make remote access to postgresql that I installed on a VM with centos 7, but I get the following error:
" Unable to connect to server:
could not connect to server: Connection refused Is the server running
on host "xxx.xxx.xxx.xxx" and accepting TCP/IP connections on port
5432? "
know that I have already changed the files pg_hba.conf and postgresql.conf but this did not work

Can't connect to the default server of pgAdmin 4

I have just installed the pgAdmin-4, and trying to connect to the default server installed with it (PostgreSQL 9.5). It asks for the password (Which I assume by default it's "postgres"), however, I keep receiving the following message:
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? 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 am working on Windows 7.
Any ideas on how to fix this problem?
The first thing is to remove pgadmin from the problem. Try to connect with the command line using psql - if you get the same message you know that the problem is not with pgadmin. If the problem continues with psql then probably your configuration of postgresql is not complete. The issue might be in the file pg_hba.conf - this file controls who is allowed to connect to the backend. You might also check that the server application is running, using an appropriate Windows utility.