Postgresql connection via terminal - pgadmin

15,981

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.

Share:
15,981
Patric
Author by

Patric

Updated on June 05, 2022

Comments

  • Patric
    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 TRUE
    • pg_hba.conf -> 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:

    1. Made restart of my postgres server on the virtual machine.

    2. Then i went to my host machine (Snow Leopard), build a ssh connection to the virtualbox (ubuntu) and it's working.

    3. ping my guest machine on port 5432 also works.

    4. Open pgadmin on my host machine (Snow Leopard) -> added server 192.68.56.1 and database pluto, user pippo. The connection worked and i see the DB.

    5. 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?