0

When I try to login to postgres I get the following error:

# psql -U trifacta -h 127.0.0.1 trifacta
psql: FATAL:  Ident authentication failed for user "trifacta"

# psql -d trifacta -U trifacta -w
psql: FATAL:  Peer authentication failed for user "trifacta"

I have added trifacta user into pg_hba.conf. below is the pg_hba.conf script

local trifacta trifacta md5
host trifacta trifacta 127.0.0.1/32 md5
host trifacta trifacta ::1/128 md5

# Entries for trifactaactiviti user

local trifacta-activiti trifactaactiviti md5
host trifacta-activiti trifactaactiviti 127.0.0.1/32 md5
host trifacta-activiti trifactaactiviti ::1/128 md5


###### TRIFACTA ENTRIES - END ######


# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

list of roles and dbs

I have tested by changing md5 to peer and trust and still had the same issue. I don't know what else I can try here.

Any help is appreciated.

Thanks in advance

Jim Jones
  • 18,404
  • 3
  • 35
  • 44
Ravin2015
  • 1
  • 4
  • is it asking you for the password? – 404 Apr 03 '18 at 15:26
  • nope it doesn't ask for password. If I use command #sudo -u trifacta -P psql postgres then it directly takes me to postgres but I am trying to login with username and password which is required for one of application – Ravin2015 Apr 03 '18 at 15:34
  • change `-w` to `-W` – 404 Apr 03 '18 at 15:35
  • @eurotrash still same error # psql -d trifacta -U trifacta -W Password for user trifacta: psql: FATAL: Peer authentication failed for user "trifacta" – Ravin2015 Apr 03 '18 at 15:36
  • so if you enter this: `psql -d trifacta -U trifacta -W` and then enter your password at the prompt, it doesn't work? Assuming you do in fact have a database and role with those names and the server is running locally. – 404 Apr 03 '18 at 15:39
  • @eurotrash nope, it doens't work. Yes they do exist, check https://i.stack.imgur.com/ysUdV.jpg – Ravin2015 Apr 03 '18 at 15:44
  • 1
    Perhaps something like: `GRANT CONNECT ON DATABASE trifacta TO trifacta;` – Jim Jones Apr 03 '18 at 15:52
  • @JimJones executed the given statement and I am still executing the same error – Ravin2015 Apr 03 '18 at 16:00
  • Well, so my last guess would be that your `pg_hba.conf` isn't updated in the system. Execute the following query and try to connect again: `SELECT pg_reload_conf();` – Jim Jones Apr 03 '18 at 16:02
  • @JimJones executed the select command and restarted the server as well but still getting the same error – Ravin2015 Apr 03 '18 at 16:16

0 Answers0