기본설정은 버전이 변경되도 크게 바뀌지 않는다
설정파일
postgresql.conf
https://www.postgresql.org/docs/9.5/static/runtime-config-connection.html
1 2 3 4 5 6 |
사용자가 늘어서 튜닝을 해야한다 하는상황이 아니라면 이거말구 크게 바꿀게 없다. listen_addresses = 'localhost' listen_addresses = '*' listen_addresses = '192.168.0.2,localhost' listen_addresses = '127.0.0.1' |
pg_hba.conf
- https://www.postgresql.org/docs/9.1/static/auth-pg-hba-conf.html
1 2 3 4 5 6 |
개발용이면 보통은 이거한줄 추가하지 않을까 host all all 127.0.0.1/0 md5 운영서버라면 서버 ip를 명시하면 되고 서버 범위 지정하는거면 ip주소 쓰는칸에 192.168.0.0/24 |
터미널접속
sudo -u postgres psql -U postgres -w
사용자 관리
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
사용자 목록보기 postgres=# \deu postgres=# \du create user ${my-user} with password '${my-password}'; create database ${my-database}; grant all privileges on database ${my-database} to ${my-user}; 권한문제 나올 때 create user --superuser ${my-user} alter role ${my-user} superuser; 관리자권한 줘버리는거나 껄쩍지근하기도 한데... 완료후 권한축소 alter role ${my-user} nosuperuser; |