CREATE USER
Synopsis
Use the CREATE USER
statement to create a user. The CREATE USER
statement is an alias for CREATE ROLE
, but creates a role that has LOGIN privileges by default.
Syntax
create_user ::= CREATE USER role_name
[ [ WITH ] role_option [ , ... ] ]
role_option ::= SUPERUSER
| NOSUPERUSER
| CREATEDB
| NOCREATEDB
| CREATEROLE
| NOCREATEROLE
| INHERIT
| NOINHERIT
| LOGIN
| NOLOGIN
| CONNECTION LIMIT connlimit
| [ ENCRYPTED ] PASSWORD ' password '
| PASSWORD NULL
| VALID UNTIL ' timestamp '
| IN ROLE role_name [ , ... ]
| IN GROUP role_name [ , ... ]
| ROLE role_name [ , ... ]
| ADMIN role_name [ , ... ]
| USER role_name [ , ... ]
| SYSID uid
create_user
role_option
Semantics
See CREATE ROLE
for more details.
Examples
- Create a sample user with password.
yugabyte=# CREATE USER John WITH PASSWORD 'password';
- Grant John all permissions on the
yugabyte
database.
yugabyte=# GRANT ALL ON DATABASE yugabyte TO John;
- Remove John’s permissions from the
yugabyte
database.
yugabyte=# REVOKE ALL ON DATABASE yugabyte FROM John;
See also
当前内容版权归 YugabyteDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 YugabyteDB .