PostgreSQL创建用户并授权

创建用户

1.登录容器环境
docker exec -it postgres bash

2.切换postgres用户
su - postgres

3.执行psql命令
psql

4.创建用户
create user admin with password 'admin';

5.创建数据库
CREATE DATABASE test_db OWNER admin;

6.授予权限
GRANT ALL PRIVILEGES ON DATABASE test_db TO admin;

7.退出
\q

参考

https://blog.csdn.net/Rong_Toa/article/details/88917424

https://blog.csdn.net/u011197085/article/details/134862148