今天是openGauss每日一练的第4天,今天学习了角色的一些命令,经过学习测试,学到以下几点知识:
1、创建角色的方式与oracle兼容,但也有自己的特色;(兼容度越高,其他数据库的工程师学习起来也就越方便)
2、默认的密码策略对密码有要求,比较安全。
测试样例:
omm@modb:~$ gsql -r
gsql ((openGauss 2.0.0 build 78689da9) compiled at 2021-03-31 21:03:52 commit 0 last mr )
Non-SSL connection (SSL connection is recommended when requiring high-security)
Type "help" for help.
omm=# create role role1 identified by "role1";
omm=# ERROR: Password must contain at least 8 characters.
omm=# create role role1 identified by "role1role1";
ERROR: Password must contain at least three kinds of characters.
omm=# create role role1 identified by "Role1Role1";
NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.
CREATE ROLE
omm=# create role role2 identified by "Role2Role2" valid begin "2021/12/08";
ERROR: syntax error at or near ""2021/12/08""
LINE 1: ...ole role2 identified by "Role2Role2" valid begin "2021/12/0...
^
omm=# create role role2 identified by "Role2Role2" valid begin '2021/12/08';
NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.
CREATE ROLE
omm=# create role role3 identified by "Role3Role3" LOGIN;
NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.
CREATE ROLE
omm=# alter role role1 rename to role11;
NOTICE: MD5 password cleared because of role rename
ALTER ROLE
omm=#
omm=# grant omm to role3;
GRANT ROLE
omm=# revoke omm from role3;
REVOKE ROLE
omm=# drop role role3;
DROP ROLE
omm=# \du
List of roles
Role name | Attributes | Mem
ber of
-----------+------------------------------------------------------------------------------------------------------------------+----
-------
gaussdb | Sysadmin | {}
omm | Sysadmin, Create role, Create DB, Replication, Administer audit, Monitoradmin, Operatoradmin, Policyadmin, UseFT | {}
role11 | Cannot login | {}
role2 | Cannot login +| {}
| Role valid begin 2021-12-08 00:00:00+08 |
omm=# create role role3 identified by "Role3Role3" LOGIN;
NOTICE: The encrypted password contains MD5 ciphertext, which is not secure.
CREATE ROLE
omm=# \du
List of roles
Role name | Attributes | Mem
ber of
-----------+------------------------------------------------------------------------------------------------------------------+----
-------
gaussdb | Sysadmin | {}
omm | Sysadmin, Create role, Create DB, Replication, Administer audit, Monitoradmin, Operatoradmin, Policyadmin, UseFT | {}
role11 | Cannot login | {}
role2 | Cannot login +| {}
| Role valid begin 2021-12-08 00:00:00+08 |
role3 | | {}
omm=# drop role role3;
DROP ROLE
omm=# drop role role2;
omm=# DROP ROLE
omm=# drop role role11;
DROP ROLE




