Postgresql connection via terminal - pgadmin
I have a problem connecting (using SSH) to my postgres server on a virtual server (ubuntu). I configured everything well and correctly.
PostgreSQL settings:
-
postgresql.conf
→ Allow all incoming connections (*) and set ssl TRUE -
pg_hba.con
f -> after a lot of changes I ended up with what seems to work with these 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:
-
Did a reboot of my postgres server in a virtual machine.
-
Then I went to my host machine (Snow Leopard), built an ssh connection to virtualbox (ubuntu) and it worked.
-
ping my guest machine on port 5432 also works.
-
Open pgadmin on my host machine (Snow Leopard) -> added 192.68.56.1 server and database
pluto
, userpippo
. The connection worked and I can see the DB. -
Tried open TERMINAL in Snow Leopard and ran the 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 and I got the same error.
What am I doing wrong?
source to share
Open my request in pgAdmin from the command line:
-f File containing your SQL script to load in the query window
-qc Connection string without password (you can also use ssl connections)
"C:\Program Files\PostgreSQL\9.4\bin\pgAdmin3.exe" -f "C:\slqFiles\FindFunctionByName.sql" -qc "host=localhost port=5432 dbname=myDatabase user=postgres"
The password will be collected from the password file located in the application folder:% APPDATA% \ postgresql \ pgpass.conf
You need permissions to connect . Try adding the following line to C: \ Program Files \ PostgreSQL \ 9.6 \ data \ pg_hba.conf:
host all all :: / 0 trust
source to share