SQL #8 role postgres does not exist 에러

SQL #8 role postgres does not exist 에러 #

#2026-02-08


#에러

asyncpg.exceptions.InvalidAuthorizationSpecificationError: role "postgres" does not exist

#트러블슈팅

SiLok 백엔드의 .env에 DB 접속 정보가 이렇게 설정되어 있음

DATABASE_URL="postgresql+asyncpg://postgres:1234@localhost:5432/septime-db"

postgres 유저로 접속하려 하는데, 로컬 PostgreSQL에는 yshmbid, myuser role만 존재하고 postgres role이 없었음

psql -c "SELECT usename FROM pg_catalog.pg_user;" 2>/dev/null || psql -U yshmbid -d postgres -c "SELECT usename FROM pg_catalog.pg_user;" 2>/dev/null || whoami
 usename 
---------
 yshmbid
 myuser
(2 rows)

아래 커맨드로 role 생성해줌.

psql -d postgres -c "CREATE ROLE postgres WITH LOGIN SUPERUSER PASSWORD '1234';"

#