--創建角色,賦予角色屬性 create user batman password '12345' superuser createrole createdb --添加到角色組 grant postgres to batman
以上是直接創建管理員角色,如果是修改一個角色為管理員角色的話
alter role spiderman createrole;
創建用戶的格式為:
CREATE ROLE name [ [ WITH ] option [ ... ] ] where option can be: SUPERUSER | NOSUPERUSER | CREATEDB | NOCREATEDB | CREATEROLE | NOCREATEROLE | INHERIT | NOINHERIT | LOGIN | NOLOGIN | REPLICATION | NOREPLICATION | BYPASSRLS | NOBYPASSRLS | CONNECTION LIMIT connlimit | [ ENCRYPTED | UNENCRYPTED ] PASSWORD 'password' | VALID UNTIL 'timestamp' | IN ROLE role_name [, ...] | IN GROUP role_name [, ...] | ROLE role_name [, ...] | ADMIN role_name [, ...] | USER role_name [, ...] | SYSID uid
數據庫的一些設置:
1、最大連接數設置 max_connections = 1000
2、轉義打開 standard_conforming_strings = off