Wednesday, October 6, 2010

psql: FATAL: Ident authentication failed for user "postgres"

I encounter this problem when trying to list down the db for a newly installed Postgress on a machine ::

#host:>psql -Upostgres -l
psql: FATAL:  Ident authentication failed for user "postgres"

What to do::
1-> su - postgres    and then run psql.  Or:  Edit pg_hba.conf, and write   trust  instead of "ident sameuser" -- then reload PostgreSQL

Open up the pg_hba.conf 
# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL listen
# on a non-local interface via the listen_addresses configuration parameter,
# or via the -i or -h command line switches.
#



# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                                      trust          <-- default is ident sameuser
# IPv4 local connections:
host    all         all         127.0.0.1/32          trust         <-- default is ident sameuser
# IPv6 local connections:
host    all         all         ::1/128                  trust         <-- default is ident sameuser

Centos 7 reset root/ any user lost password / lockout due to cant remember password

1. Need to be in front of the terminal. (Physically if not vm). 2. Reboot the server 3. Press 'e' in the GRUB2 boot screen. 3. bunch...