PostgreSQL 사용자 권한 생성 및 사용자 생성
postgreSQL 접속
psql postgres
\du 명령어를 입력합니다.
postgres=# \du
실행결과
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
goodsaem | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
goodsaem 유저의 패스워드를 변경합니다.
postgres=# \password goodsaem
Enter new password:
Enter it again:
신규 유저 생성
CREATE USER aptdb PASSWORD 'aptdb' SUPERUSER;
신규 유저로 로그인
psql postgres -U aptdb
데이터베이스 생성
CREATE DATABASE aptdb;
생성된 DB 확인
postgres=# \l
실행결과
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+-------+-----------------------
aptdb | aptdb | UTF8 | C | C |
postgres | goodsaem | UTF8 | C | C |
template0 | goodsaem | UTF8 | C | C | =c/goodsaem +
| | | | | goodsaem=CTc/goodsaem
template1 | goodsaem | UTF8 | C | C | =c/goodsaem +
| | | | | goodsaem=CTc/goodsaem
(4 rows)