0

I installed postgresql9.1 into my Centos 6.4. I can do psql template (as root) to open the database console but cannot use Rails rake db:create to create the database: FATAL: Ident authentication failed for user "root"

My configuration is as follow:

{
"adapter"=>"postgresql", 
"host"=>"localhost", 
"encoding"=>"unicode", 
"username"=>"root", 
"pool"=>5, 
"database"=>"xxx_prod"
}

I guess Rails is unable to locate the sock file (.s.PGSQL.5432). So I would like to specify it explicitly but I don't know where the sock file is located. Where should it be? How can I locate it?

1 Answer 1

2

The problem is not the sock file, but the (very bad in my opinion) decision to make "ident" default authentication scheme.

Locate pg_hba.conf file and change "ident" into "trust" or "md5".

If you want to know more - consider reading this blogpost.

5
  • Please add the relevant contents instead of self-promoting your blog without disclosure. Jun 21, 2013 at 11:31
  • After reading some of your posts, I am convinced of their value to the community; if you copy the relevant contents into the answer, you will remove a single-point-of-failure if your blog goes down. (Yes, there's also the Wayback Machine, but we shouldn't rely on it either). Jun 21, 2013 at 11:37
  • What about - when SO will go down? My blog is online longer than SO. The relevant part is already in answer - find pg_hba.conf, and change authentication scheme.
    – user13185
    Jun 21, 2013 at 11:55
  • So when I do psql template1, what kind of authentication is being used? Jun 22, 2013 at 4:44
  • We can't know. You have to check in your pg_hba.conf file.
    – user13185
    Jun 22, 2013 at 9:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .