0
votes

When I run rails db:setup, I get this error message:

FATAL: Ident authentication failed for user "rails_dev"
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"myapp_test", "username"=>"rails_dev", "password"=>"aqwe123", "host"=>"localhost", "port"=>5432}
rails aborted!

PG::ConnectionBad: FATAL: Ident authentication failed for user "rails_dev"
/home/whitehat/.rvm/gems/ruby-2.4.0/gems/pg-0.21.0/lib/pg.rb:56:in 'initialize'
/home/whitehat/.rvm/gems/ruby-2.4.0/gems/pg-0.21.0/lib/pg.rb:56:in 'new'
/home/whitehat/.rvm/gems/ruby-2.4.0/gems/pg-0.21.0/lib/pg.rb:56:in 'connect

1
Can you paste your database.yml here?Chetan Mehta

1 Answers

1
votes

After long search, I found the solution; the issue was in the PostgreSQL configuration file pg_hba.conf. I changed the ident method to MD5 and it worked.

local   all             all                                     MD5
host    all             all             127.0.0.1/32            MD5
host    all             all             ::1/128                 MD5