#opengauss学习的第五天
创建用户user1、user2和user3,user1具有CREATEROLE权限,user2具有CREATEDB权限,要求使用两种不同的方法设置密码
create user user1 createrole encrypted password ‘r^123.comCOM’;
NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.
CREATE ROLE
omm=# create user user2 createdb encrypted password ‘r^123.comCOM’;
NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.
CREATE ROLE
omm=#
\du
-----------±------------------------------------------------------------------------------------------------------
-----------±----------
gaussdb | Sysadmin
| {}
omm | Sysadmin, Create role, Create DB, Replication, Administer audit, Monitoradmin, Operatoradmin, Policyad
min, UseFT | {}
user1 | Create role
| {}
user2 | Create DB
| {}
List of roles
Role name | Attributes
| Member of
#2种方法修改密码
create user user1 createrole encrypted password ‘r^123.comCOM’;
alter user user1 identified by ‘r^123.comCO’;
修改用户user1的密码
alter user user1 identified by ‘r^123.comCO’;
NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.
ALTER ROLE
重命名用户user2
alter user user2 rename to user3;
NOTICE: MD5 password cleared because of role rename
ALTER ROLE
将用户user1的权限授权给用户user3,再回收用户user3的权限
mm=# grant user1 to user3;
GRANT ROLE
omm=# revoke user1 from user3;
REVOKE ROLE
删除所有创建用户
omm=# drop user user1;
DROP ROLE
omm=# drop user user3;
DROP ROLE
omm=# drop user user4;
DROP ROLE
omm=# \du
List of roles
Role name | Attributes
| Member of
-----------±------------------------------------------------------------------------------------------------------
-----------±----------
gaussdb | Sysadmin
| {}
omm | Sysadmin, Create role, Create DB, Replication, Administer audit, Monitoradmin, Operatoradmin, Policyad
min, UseFT | {}




