24

While opening query tool via pgadmin, i am getting this error on popup.

could not send data to server: Socket is not connected could not send SSL negotiation packet: Socket is not connected

Does any one know why this is happening.

Bhavesh Tilvani
  • 353
  • 1
  • 2
  • 5

2 Answers2

61

try changing your host connection to "127.0.0.1" instead of "localhost" it worked for me

Aya Hayder
  • 726
  • 5
  • 3
  • 1
    If your local resolution makes `localhost` not resolve to `127.0.0.1`, you have a big problem on your hand as almost everything running out there is excepting this name resolution. – Patrick Mevzek Feb 20 '20 at 18:45
  • 6
    @PatrickMevzek, `localhost` also resolves to the IPv6 loopback address `::1`, while postgres might be configured to listen on `127.0.0.1` only. – Piotr P. Karwasz Feb 20 '20 at 20:42
  • 2
    Thanks! This bug is ridiculous. I could see everything about my db but not the rows of tables. – Charming Robot May 19 '20 at 14:52
  • @CharmingRobot, you're welcome, hahaha yes it is – Aya Hayder May 19 '20 at 15:27
  • This worked for me. The interesting this is 127.0.0.1 was assigned to Kubernetes when I enabled docker. Is this by design? – Navap Nov 23 '21 at 14:00
  • This also resolved my issue when working with a postgres server running in VS code development docker container. – Niilo Keinänen Feb 25 '22 at 08:01
0

You might consider that another app is using the socket. Or the postgres pg_hba.conf needs to be modified to allow non-local access.

Mophilly
  • 13
  • 4
  • Can you provide me the modifications needs to be done in the pg_hba.conf file? – Bhavesh Tilvani Feb 05 '20 at 11:13
  • Every situation has different details on IP address ranges and such. Please review this page: https://www.postgresql.org/docs/current/auth-pg-hba-conf.html After that, please post again if you have questions. – Mophilly Feb 06 '20 at 17:04