I've created a new role and Database in the following way (with postgres user):
CREATE ROLE xxx LOGIN
PASSWORD 'CHOOSEAPASSWORD'
NOSUPERUSER INHERIT NOCREATEDB CREATEROLE REPLICATION;
CREATE DATABASE xxx
WITH OWNER = xxx
ENCODING = 'UTF8'
TABLESPACE = pg_default
CONNECTION LIMIT = -1;
\connect xxx
GRANT ALL ON DATABASE xxx TO xxx;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO xxx;
In the pg_hba.conf I've the following entries:
local all postgres trust
local all all peer
# IPv4 local connections:
host all xxx 127.0.0.1/32 trust
host all all 127.0.0.1/32 ident
Nevertheless I can't connect with
psql -U xxx -h localhost -W
and get the error
psql: FATAL: Ident authentication failed for user "xxx"
Any ideas where I could have a mistake? (I use PostgreSQL 9.4 and CentOS 6.7)