暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

openGauss每日一练第4天|学习心得

原创 何权林 2021-12-08
382

今天是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

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论