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 and
2.

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!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs