Cannot start Postgres on port 5432 - postgresql

I just installed postgres.app, but when I try to start the server I get the following error:
After checking some answers in a similar thread I verified that my PATH is defined correctly and that no other process is running on port 5432:
So what's going on with port 5432?

Simple solution. Uninstalled and reinstalled and now everything works on port 5432. Very strange error, I am curious if anyone has any ideas about how this happened.

Related

PostgreSQL Question ! Port problem :( (0x0000274D/10061)

My cmd is looking for port 5432. Initially, it was set as 5433 in installation so I had to change it from postgresql.conf. But then I could not use pgAdmin because it is looking for port 5433 how do I make one of them look for the same port?
It was a dumb question... But in case someone else has the same situation, the answer is to right-click on your server in pgAdmin, click properties and then change the desired port!

"psql: server closed the connection unexpectedly" working locally on MacOS

I encountered a weird issue with my Postgres, suddenly (after YEARS) I can't connect to it using my Golang application code or via psql but the funny thing is that my DBeaver application can!
This is what I try and the error I get:
psql -U postgres -h localhost
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
I did some research and tried a bunch of stuff which seems to resolve this issue for other users :
Following this answer I made sure that both pg_hba.conf and postgresql.conf files configured correctly (added listen_addresses = '*' to postgresql.conf and made sure that I accept any IP host all all 0.0.0.0/0 trust in pg_hba.conf.
Following this answer I've downgraded my Postgres version from 12 to 10 and it did not work either.
Removed EVERYTHING related to Postgres and reinstalled using Homebrew using this guide
Removed the Homebrew installation and tried to use the PostgresApp for Mac - no luck either.
I'm stuck!
Does anyone know what could go wrong? I have no idea what went wrong to cause this issue.
I'm working on OSX Catalina 10.15.4 if it helps.
Any help will be highly appreciated!
Update:
Step 2 works great, the issue was with the latest update of my anti-virus (ESET).

Can't connect to MongoDB server on Google Compute Engine from second VM instance

I have MongoDb installed on two Ubuntu 16 VMs both hosted on the same network on Google Cloud's Compute Engine. The connecting instance has Internal IP 10.132.0.2, the database instance has 10.132.0.3.
(https://gyazo.com/59f9086591a1d6673e8194a50fff51e1)
I've opened tcp 27017 for the instance I wish to connect to. I added this using the gcloud console commands.
(https://gyazo.com/0d158aa735c6967e278fac63d598721f)
I have also tried opening tcp:1-65535;udp:1-65535 for testing purposes, with no result.
Running mongo on either instance will properly connect to it's own mongodb service, so they're installed, running and working.
On the database instance, netstat -a | grep :27017 displays that it's listening correctly.
(https://gyazo.com/0f4fb3c49a51f6886ff4ccb2d44a132a)
On the database instance, the config file at /etc/mongod.conf of the is edited so bind_ip also has the Internal IP of said instance.
(https://gyazo.com/20fb669506e7e67ef49fdcf9af6df144)
I have also tried 0.0.0.0 for testing purposes, with no result.
Running mongo 10.132.0.3 from the connecting instance results in Failed to connect to 10.132.0.3:27017, reason: errno:111 Connection refused.
(https://gyazo.com/9e5aec732e3f09cbfa62a4d78df3620f)
Running nmap -p 27017 10.132.0.3 on the connecting instance shows port 27017 is closed.
(https://gyazo.com/7ccd905db5b9946d616176b9ab75479c)
I'm at an utter loss, please help me out? :<
Your mongodb servers are only listening on the localhost address (127.0.0.1), rather than on INADDR_ANY (shows up as *:27017 in netstat).
Like this question, it looks like you need to set bind_ip = 0.0.0.0 in your mongod.conf.
Thanks to E. Anderson's link I managed to solve this issue; suddenly turning this into a duplicate. However, neither this answer nor the answer in the link were "correct".
The solution to set bind_ip=0.0.0.0 in mongod.conf is rather dangerous, besides, it didn't work. However, killing the mongodb service, and then manually running mongod --bind_ip 10.132.0.3 actually allowed my two instances to connect.
Which.. means that javadude's reply in the other thread saying "But I still dont get it. Why this did not work when I modified mongo.conf file to accept bind_ip 0.0.0.0"` also goes for me. I don't get it, but, it definitely worked to manually give it an ip-address to listen on.

pgAdmin and PostgreSQL: can't connect to server

I just installed PostgreSQL on Snow Leopard and can't connect to the database server via pgAdmin 3.
I'm on my local machine, however I keep getting this error:
Could not connect to server: connection refused. Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5423?
I'm a bit of a noob when it comes to Postgres, so I'm not really sure what the problem is.
I can, however, log in through the command line, via psql -U postgres, and start and stop the server successfully.
Any help would be much appreciated.
The error message pointed out that you tried to connect to server on port 5423. However, postgres server listens on 5432 by default.
From your above comment (SHOW port; gives me "5432"), I think you need to change the port to 5432!
UPDATE: Tuan Dang spotted it. I'll leave this answer in place in case it helps someone else for whom the issue isn't quite the same.
Since you can connect via the command line, run:
SHOW port;
from psql. You'll probably see that the port is not 5432. You need to connect to the port PostgreSQL is actually running on from your application.
It's also possible that it just isn't listening on TCP/IP. Run:
SHOW listen_addresses;
to see what it's listening for.
The reason you can connect via the command line is likely to be because the command line psql you're using is connecting over a unix socket (since you didn't specify a host) and your app is connecting via tcp/ip.

general sql error

I have created an application in delphi and backend is postgres when i run the application i get the following error
general sql error.could not connect to the server;no
connection could be made because the target machine actively refused
it.[127.0.0.1:1:5433 alias resumep
I uninstalled it and installed it again but it didnt work.Even i changed the port number while installing .
I changed the password and installed again but its giving same error
what is the solution to this problem?
The database cluster of a standard PostgreSQL installation is listening on port 5432. (You can, of course, set up additional db clusters on different ports or configure your database cluster to listen on any other port.)
Any particular reason you try 5433? This is probably the cause of your problem.
If no server is listening on port 5433, the connection is simply not possible.