当前位置: 首页 > news >正文

网站建设风格百度网站安全检测

网站建设风格,百度网站安全检测,潍坊百度seo,快捷网站建设pgsql-用户&角色&组角色创建和维护 环境 win10pgsql 14.2 相关文档 PostgreSQL 14.1 手册 create 语法 grant 授权语法 revoke 撤回语法 alter 更新语法 用户、角色、组角色概念和区别 早期版本(8.1之前)中用户、组、角色是不同的概念&#…

pgsql-用户&角色&组角色创建和维护

环境

  • win10
  • pgsql 14.2

相关文档

PostgreSQL 14.1 手册
create 语法
grant 授权语法
revoke 撤回语法
alter 更新语法

用户、角色、组角色概念和区别

早期版本(8.1之前)中用户、组、角色是不同的概念,现在角色的概念把“用户”和“组”的概念都包括在内。角色可以完成登录用户、组角色功能。

  • 作为组角色时,可以不为角色分配login属性;
  • 作为登录用户时,可以添加login属性,并设置认证类型(登录密码),如 password ‘123456’;
  • 为角色授予访问权限,如为数据库对象schema、table或者column的访问权限,每种对象有不同的特性;

数据库对象的关系

  • database 数据库实例,一个实例可以包含多个schema,不同实例间数据不共享;
  • scheam 模式,对表的一个分组,同实例下的模式可以共享;
  • table 数据表;
    以上可以统称为数据库对象,授权体系中需要不同对象有相关的特性,都需要独立授权;

ps:如果对表授予select权限,但是无schema的usage权限,查询时会提示用户没有xx模式的权限,但是有schema的usage权限时,同时具备了表的curd权限,感觉不应该出现这个现象;

创建测试表

‘’’
create schema mall;
–建table
create table mall.product
(
id varchar(32) not null constraint product_pk primary key,
name varchar(128),
price int
);
create table mall.“order”
(
id varchar(32) not null
constraint order_pk
primary key,
count int,
price int
);
–数据初始化
insert into mall.product(id,name,price) values (‘p1’,‘n1’,1),(‘p2’,‘n2’,2),(‘p3’,‘n3’,3);
insert into mall.order(id,count,price) values (‘o1’,1,1),(‘o2’,2,2),(‘o3’,2,3);
–CRUD验证
select * from mall.product;
delete from mall.product where id=‘x’;
update mall.product set name=‘x’ where id=‘x’;
insert into mall.product(id,name,price) values (‘p1’,‘n1’,1);
select * from mall.order;
‘’’

测试用例

‘’’
–基础语法结构
/*
创建:CREATE ROLE role_name;
授权:GRANT group_role TO role1, … ;
撤回:REVOKE group_role FROM role1, … ;
删除:DROP ROLE role_name;
*/
–角色组语法
create role group_role;–创建组角色
create role role1;
create role role2;
grant group_role to role1;
grant group_role to role1,role1;
–角色&用户
create role w_user login password ‘123456’; --准许登录并设置密码
create role r_user login password ‘123456’;
alter role r_user password ‘123123’; --修改密码
–scheam权限 { CREATE | USAGE }
grant all on schema mall to w_user;–所有特性授予单个角色
grant all on schema mall to w_user,r_user;–所有特性授予多个角色
grant all on schema mall to public;–所有特性授予所有角色
grant usage on schema mall to r_user;
revoke all on schema mall from w_user; --撤回
–table权限
grant all on mall.product to w_user;–单表单用户
grant all on mall.product,mall.“order” to w_user;–多表单用户
grant all on all tables in schema mall to w_user,r_user;–所有表多用户
grant all on all tables in schema mall to public;–所有表所有用户
grant all on mall.product to r_user;
grant all on all tables in schema mall to r_user;
revoke all on all tables in schema mall from r_user;
–撤回授权
revoke all on schema mall from public;–所有用户mall模式下的所有权限
revoke all on schema mall from w_user;–单用户mall模式下的所有权限
revoke all on all tables in schema mall from w_user;–单用户mall下所有表的crud权限
revoke all on all tables in schema mall from public;–所有用户mall下表的所有权限
revoke all on schema mall from r_user;
revoke all on all tables in schema mall from r_user;
‘’’

总结

pgsql高版本中授权体系里将用户、组、角色都合并到role对象中,完全松散管理。没有login特性的role可以理解为角色;带login特性的可以理解为用户;
官方文档中grant 授权语法里的语法结构仔细的看看,结构基本一致注意下on后边的关键字,对角色的理解很有帮助。

http://www.mnyf.cn/news/35190.html

相关文章:

  • 韩国网站的风格百度竞价外包
  • 黄江镇做网站优化网站有哪些方法
  • 下载网站如何做线上推广平台
  • 互联网保险公司十大排名seo的工作内容
  • 没有网站怎么做推广中国万网域名注册
  • 吉林网站建设费用小程序排名优化
  • 网站系统升级建设合同有品质的网站推广公司
  • 天空人体网站怎么做app推广引流方法
  • 网站设计的概述技术短期培训班
  • 石家庄网站优化推广太原网站快速排名优化
  • 一个静态网站多少钱百度搜索下载
  • 怎么做阿里巴巴国际网站首页百度竞价排名
  • 网站建设域名注册北京seo网站设计
  • 免费网站图片素材网络营销专业就业方向
  • 顺德网站建设策划sem和seo哪个工作好
  • 网站ftp需要关闭广东疫情最新消息今天
  • 沈阳 网站开发制作seo快速排名网站优化
  • 成立公司注册资金要求太原seo外包服务
  • 动态网站设计心得怎么在百度上添加自己的店铺地址
  • 北京网站建设公司东为在线看seo网站
  • 企业做网站的步骤与做网站注意事项今日新闻头条新闻今天
  • jsp个人网站毕业论文怎么做千瓜数据
  • 那种广告式网站怎么做网络营销类型
  • 云南做网站费用seo最新
  • 郑州交友网站开发公司廊坊网站seo
  • 企业网站建设方案详细方案网络营销管理名词解释
  • 做别人的网站诈骗视频杭州seo渠道排名
  • 论坛网站怎么做免费的推广引流软件下载
  • dwcs5怎么把做的网站适屏免费手机优化大师下载安装
  • 关于做网站的南京seo网站优化推广