0

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
Madh
  • 21
  • 1
  • 2
  • I have looked at the solution presented for that question , but my issue is not resolved by that. – Madh Nov 27 '19 at 09:53

1 Answers1

0

You can try...

host    all             all             127.0.0.1/32            trust

and then

psql -h localhost -U postgres DB
Zakir Hossain
  • 440
  • 5
  • 20