Monday, June 29, 2015

[Rails] Why I get the error: Ident authentication failed for user 'abelard' under Cent OS 6, PostgreSQL 9.4

All config files described here are the same as my Mac OS's and all works fine in Mac OS.
 
I got the same error in CentOS 6 x86_64:
 
    Ident authentication failed for user 'abelard'
When running the following two commands:

    1. rake db:create
    2. psql -d testforabelard2 -U abelard -h localhost
I got the same error after trying these answers [1](http://stackoverflow.com/a/8102547/1054800) and [2](http://stackoverflow.com/a/2942678/1054800).

My `/var/lib/pgsql/9.4/pg_hba.con`'s content is as follows:

    local   all             all                                     trust
    host    all             all             127.0.0.1/32            trust
    host    all             all             ::1/128                 trust
And there is a blank file `/var/lib/pgsql/9.4/pg_ident.con`

My `database.yml`'s content is as follows:

    development:
      adapter: postgresql
      encoding: unicode
      database: social_stream_development
      pool: 5
      username: abelard
      password: password
And for offering the same params as my Mac OS's, I altered `PostgreSQL`'s user `abelard` :

    testforabelard2=# \du
                List of roles
     Role name | Attributes  | Member of 
    -----------+-------------+-----------
     abelard   | Superuser   | {}
               : Create role   
               : Create DB     
     postgres  | Superuser   | {}
               : Create role   
               : Create DB   
And I can run the command without `-h localhost` successfully:
    
    psql -d testforabelard2 -U abelard
I don't know what things I miss, any advice will be welcome!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6be0b0c1-8851-4115-8bce-04f98119ccc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment