본문 바로가기
아이티 공부/PostgreSQL

PostgreSQL 에러, no pg_hba.conf entry for host

by Klero 2019. 6. 4.
반응형
connection to PostgreSQL: pq: no pg_hba.conf entry for host


어떤 모니터링 솔루션에서 PostgreSQL 모니터링을 위해

설정작업을 했는데 위와 같은 에러가 발생했다.

하지만 해결방법은 매우 간단했다.

postgresql 설정파일인 pg_hba.conf 파일을 수정하면 된다.




/home/postgres/pgsql/data/pg_hba.conf


local   all             all                                      trust

host    all             all             0.0.0.0/0            trust

-->

local   all             all                                      md5

host    all             all             0.0.0.0/0            md5


그 후 postgreSQL DB를 재시작한다.


참고로 trust는 방화벽만 맞으면 그냥 접속이 가능하다.

md5는 DB 접속을 위한 Username과 Password를 같이

입력해야 접속 되는 방식이다.


$ psql -U newuser -d postgres

Password for user newuser:

psql (9.4.0)

Type "help" for help.


댓글