본문 바로가기
개발/Database

[PostgreSQL] 원격접속허용, 포트 변경 / DB ,스키마, 유저 생성

by Allonsy 2020. 5. 20.
반응형

# 원격접속허용 및 포트 변경

1. postgresql.conf 수정

 

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*'         # what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost'; use '*' for all
                                        # (change requires restart)
port = 5431                             # (change requires restart)

 

 

2. pg_hba.conf 라인 추가

 

host    all             all             0.0.0.0/0               md5

 

# DB ,스키마, 유저 생성 

psql

 

# CREATE ROLE username SUPERUSER LOGIN CREATEDB PASSWORD 'password';

 

# CREATE DATABASE dbname OWNER username;

 

# GRANT ALL ON DATABASE dbname TO username;

 

# \connect dbname;

 

# CREATE SCHEMA schemaname;

 

# GRANT USAGE ON SCHEMA schemaname TO username;

반응형

댓글