当前位置:网站首页>PG basics -- Logical Structure Management (user and permission management)
PG basics -- Logical Structure Management (user and permission management)
2022-07-05 19:14:00 【51CTO】
Users and roles
stay postgreSQL in , There is no difference between roles and users , A user is also a role , You can give one user permission to another user . Users and roles are global in the entire database instance , In different databases in the same instance , The users you see are the same .
There is a predefined super user when initializing the database system , The name of this user is the same as the user name of the operating system that initialized the database .
stay pg in , There is no difference between users and roles , except create user Users created by default are login jurisdiction ,create role No user created login Out of authority ,create rule And create user There is no other difference .
How to create users
CREATE USER name [ [ WITH ] option [ ... ] ]
where option can be :
SUPERUSER | NOSUPERUSER # Is it a super user
| CREATEDB | NOCREATEDB # Whether they have create database jurisdiction
| CREATEROLE | NOCREATEROLE # Whether you have permission to create other roles
| INHERIT | NOINHERIT # If the created user has a role , Whether to automatically have role permissions
| LOGIN | NOLOGIN # Is there a LOGIN jurisdiction
| REPLICATION | NOREPLICATION # Copy permission
| BYPASSRLS | NOBYPASSRLS
| CONNECTION LIMIT connlimit
| [ ENCRYPTED ] PASSWORD 'password' | PASSWORD NULL
| VALID UNTIL 'timestamp' # Password expiration time
| IN ROLE role_name [ , ... ]
| IN GROUP role_name [ , ... ]
| ROLE role_name [ , ... ]
| ADMIN role_name [ , ... ] #with admin option jurisdiction
| USER role_name [ , ... ]
| SYSID uid
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
Rights management
stay pg in , Each logical structure object of a database has an owner , Any database object belongs to a user , There is no need to give the permission of the object to the owner , Because the owner has all permissions by default . The owner also implicitly has the right to give other users the permission to operate the object
Authority classification
The permissions specified when creating users
Superuser rights
Create database permissions
Is there a login jurisdiction
It can also be done through alter role To modify the
need grant or revoke Authority
Create... In the database schema jurisdiction
Permission to create temporary tables in the specified database
Permission to connect to a database
Permission to create database objects in the schema
select、DML Operating authority
Sequence query , Function USES , Trigger permissions
Designated table , Permissions to index to tablespaces
role_name Refers to users or roles
some_privileges Means authority
database_object_type Index database object , Such as table、schema、sequence
grant select on table mytab to public;
pg No, DDL jurisdiction , Whether to create a table , Yes, look at schema Is there a create Authority .
Authority summary
Permissions are managed hierarchically
1) First, manage the permissions assigned to users' special attributes , Such as the authority of super user , Permission to create database , Create permissions for users ,LOGIN Authority, etc .
2) Then there is the permission to create the schema in the database .
3) Next, the permissions of the objects that create the database in the schema , Create table , Index, etc. .
4) Then there is the query table , Insert data into table , Update table , Delete data permissions in the table .
5) Finally, the permissions of some fields in the operation table
边栏推荐
- android中常见的面试题,2022金九银十Android大厂面试题来袭
- Windows Oracle 开启远程连接 Windows Server Oracle 开启远程连接
- 企业级数据安全,天翼云是这样理解的
- 企业数字化转型之路,从这里开始
- RedHat7.4配置yum软件仓库(RHEL7.4)
- MySql中的longtext字段的返回问题及解决
- 2022 the latest big company Android interview real problem analysis, Android development will be able to technology
- golang通过指针for...range实现切片中元素的值的更改
- 一朵云开启智慧交通新未来
- Why can't Bi software do correlation analysis? Take you to analyze
猜你喜欢
Windows Oracle 开启远程连接 Windows Server Oracle 开启远程连接
块编辑器如何选择?印象笔记 Verse、Notion、FlowUs
Blue sky drawing bed Apple quick instructions
图扑软件数字孪生 | 基于 BIM 技术的可视化管理系统
Tianyi cloud understands enterprise level data security in this way
出海十年:新旧接力,黑马崛起
如何实现游戏中的在线计时器和离线计时器
Go语言 | 01 WSL+VSCode环境搭建避坑指南
基于FPGA的超声波测距
数学分析_笔记_第9章:曲线积分与曲面积分
随机推荐
手把手教你处理 JS 逆向之图片伪装
数据库 逻辑处理功能
JS解力扣每日一题(十二)——556. 下一个更大元素 III(2022-7-3)
EasyCVR授权到期页面无法登录,该如何解决?
图扑软件数字孪生 | 基于 BIM 技术的可视化管理系统
Go deep into the underlying C source code and explain the core design principles of redis
Tupu software digital twin smart wind power system
2022最新大厂Android面试真题解析,Android开发必会技术
Interprocess communication (IPC): shared memory
Advanced application of C # language
决策树与随机森林
5. Data access - entityframework integration
2022年5月腾讯云开发者社区视频月度榜单公布
Tutoriel de téléchargement et d'installation du progiciel fuzor 2020
MySQL数据库索引教程(超详细)
JAD的安装、配置及集成IDEA
Technology sharing | interface testing value and system
基于FPGA的超声波测距
关于 Notion-Like 工具的反思和畅想
详解SQL中Groupings Sets 语句的功能和底层实现逻辑