Today,
I was trying to configure POSTGRESQL server in Fedora Linux OS system. On my surprise, when I typed:
# psql -d railsapp_development -U rails_db_user -W
It gave me the following error:
# psql: FATAL: Ident authentication failed for user "username"
For, solving this issue, you will have to edit the following file:
vim /var/lib/pgsql/data/pg_hba.conf
This file has various functionalites apart from controlling how the user/clients are authenticated. By default, POSTGRESQL, supporst IDENT based authentication. IDENT based authentication will not allow you to login with -U and -W option.
The following changes has to be done inside pg_hba.conf file:
# Type Database User CIDR-ADDRESS METHOD
----------------------------------------------------------------------------------------------------
local all all trust
host all all 127.0.0.1/32 trust
Basically you will have to replace ident with trust.
Now restart the server with the following command:
# /etc/init.d/postgresql restart
After this you will be able to login.
Note, that I was facing the above mentioned error, when I was trying to invoke the command rake db:migrate in rails.
But after doing the above mentioned changes, migrations started working fine.