psql: FATAL: Peer authentication failed for user “dev”

Try:

psql -U user_name  -h 127.0.0.1 -d db_name

where

  • -U is the database user name
  • -h is the hostname/IP of the local server, thus avoiding Unix domain sockets
  • -d is the database name to connect to

This is then evaluated as a “network” connection by Postgresql rather than a Unix domain socket connection, thus not evaluated as a “local” connect as you might see in pg_hba.conf:

local   all             all                                     peer

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)