[PostgreSQL] 원격 DB서버 설정

hajin·2023년 5월 23일
0

기준 Ubuntu20.04, PostgreSQL 15

  1. /etc/postgresql/[버전]/main로 이동
  2. postgresql.conf를 root권한으로 편집하여 listen_port="localhost"의 주석을 해제하여 listen_port="*"로 바꾼다.
  3. pg_hba.conf도 마찬가지로 root 권한으로 편집하여
# IPv4 local connections:
host    all             all             127.0.0.1/32            

# IPv4 local connections:
host    all             all             0.0.0.0/0            

로 바꾼다.
4. PostgreSQL서비스 재시작
5. 알맞게 방화벽 설정이나 포트포워딩을 진행
6. 원격 접속 테스트

profile
restart

0개의 댓글