Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgresql is not allowed to be connected remotely

Could someone help take a look this weird problem? I'm still not able to connect remotely to my Postgresql.

My Steps:

  1. Download and install the latest Postgresql to my local machine
  2. Setup postgresql
  3. Create a DB
  4. Modify "pg_hba", add row "host all all 0.0.0.0/0 md5"
  5. Modify "postgresql.conf", make sure "listen_addresses = '*'"
  6. Restart postgresql service
  7. Open local PgAdmin, and connect to DB <-- Success!
  8. From Remote desktop, do the same thing as #7 <-- Failed!

Error Message:

"Server doesn't listen" "Could not connect to server......accepting TCP/IP connections on port 5432?"

  • I found "TCP 0.0.0.0:5432 Listening" when I type "netstat -a"
  • I checked firewall, it's not enabled ......

Can someone please help? Does anyone encounter this situation? P.S, my os is Winserver 2008

Thanks in advance~

like image 390
Wally Yu Avatar asked Dec 28 '25 11:12

Wally Yu


1 Answers

If you're connecting to the local machine via RDP then you'll be connecting via localhost and no firewall or LAN/WAN/NAT settings should affect pgadmin.

When you edit the pg_hba and postgresql.conf files Server 2008 doesn't usually let you edit them directly where they are. I usually copy them out edit them and then paste them back in. You'll need to authorise the paste from an Admin account.

I usually have a separate rule in "pg_hba" with "host all all 127.0.0.1/32 md5" for local connections. Also ensure when you restart the service that it is running under the user "postgres" and not as some other user.

like image 149
Fast Engy Avatar answered Dec 31 '25 00:12

Fast Engy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!