CATCHV Blog

[postgresql] FATAL: Peer authentication failed for user 본문

Database/Postgresql

[postgresql] FATAL: Peer authentication failed for user

catchv 2024. 1. 2. 23:00
반응형

계정을 만들고 psql로 접속시 아래와 같은 에러가 발생할수 있습니다.

 

psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  Peer authentication failed for user "my_role"

psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  Peer authentication failed for user "my_role"

 

* pg_hba.conf 파일에 local 속성이 peer로 되어 있는 것을 확인 할 수 있습니다.

peer는 os의 계정과 사용자 계정이 일치해야 접속이 됩니다

psql로 postgresql를 사용해야 되는 계정이라면 

OS 계정을 추가로 만들어 주거나 postgresql의 접속 허용 방법을 변경하면 됩니다.

 

# "local" is for Unix domain socket connections only
#local   all             all                                     peer
local   all             all                                     scram-sha-256

 

 

반응형
Comments