I am trying to connect to postgres DB using the following 2 commands and it fails to connect to DB :
- psql -h 10.x.x.x -U postgres -W
- psql -h localhost -U postgres -W
Output:
-bash-4.2$ psql -h 10.x.x.x -U postgres -W
Password:
psql: could not connect to server: Connection refused
Is the server running on host "10.54.48.59" and accepting
TCP/IP connections on port 5432?
-bash-4.2$
-bash-4.2$ psql -h localhost -U postgres -W
Password:
psql: FATAL: Ident authentication failed for user "postgres"
-bash-4.2$
But when I try to connect to DB using the command without IP, it works:
-bash-4.2$ psql -U postgres -W
Password:
psql (11.3)
Type "help" for help.
postgres=#
I tried by having the following list in my pg_hba.conf as well :
host all all 127.0.0.1/32 ident
host all all 127.0.0.1/32 md5
host all all 127.0.0.1/32 password