Postgresql connection via terminal - pgadmin
pgAdmin
tries to connect with and without SSL by default.
I suspect that you only try to connect without SSL via psql
, while the server seems to require SSL for connections. Try:
psql "sslmode=require host=192.168.56.1 dbname=pluto" pippo
More about sslmode
in the manual.
Patric
Updated on June 05, 2022Comments
-
Patric almost 2 years
I have a problem connecting (using SSH) to my virtualbox(ubuntu) postgres server. I set up all nice and correctly.
PostgreSQL settings:
postgresql.conf
-> Allowed all incomming connection (*) and set ssl TRUEpg_hba.con
f -> after a lot of changes i came to the point where it seems to work with this settings:
IP4
host all all 0.0.0.0/0 trust hostssl all all 0.0.0.0/0 trust host all all 192.168.x.x/32 trust hostssl all all 192.168.x.x/32 trust
I tried:
Made restart of my postgres server on the virtual machine.
Then i went to my host machine (Snow Leopard), build a ssh connection to the virtualbox (ubuntu) and it's working.
ping my guest machine on port 5432 also works.
Open pgadmin on my host machine (Snow Leopard) -> added server 192.68.56.1 and database
pluto
, userpippo
. The connection worked and i see the DB.Tried open TERMINAL in Snow Leopard and executed following cmd:
psql -h 192.168.56.1 -U pippo -d pluto
with ERROR:
psql: FATAL: no pg_hba.conf entry for host "192.168.56.1", user "pippo", database "pluto", SSL off
I also tried to connect through my Java Program ans I got the same error.
What am I doing wrong?