当前位置:网站首页>数据库安全 --- 创建登录名 用户+配置权限【笔记】
数据库安全 --- 创建登录名 用户+配置权限【笔记】
2022-07-28 10:12:00 【努力的张张】
项目场景:
创建用户和给用户授权
解决方案:
1、创建用户







至此用户才创建成功:
2、配置权限
把查询Student表权限授给用户test:

把对Student表和Course表的全部权限授予用户U2和U3
--把查询Student表权限授给用户test
grant select on Student to test;

问题2:all privilege用不了?
--把对Student表和Course表的全部权限授予用户test和U1
grant all
on Student to test,U1;
grant all
on Course to test,U1;

--把对表SC的查询权限授予所有用户
grant select on SC to public;

--把查询Student表和修改学生学号的权限授给用户U1
grant select,update(sno) on SC to U1;

3、创建用户名
--创建登录名,创建用户
create login zff with password='***',DEFAULT_DATABASE=STU1;
--给zff登录名创建一个用户U2
create user U2 for login zff;
--创建没有登录名的用户,不能登录,但可以被授予权限
create user U3_none without login;
4、给相关用户配置权限
--4.5 把对表SC的INSERT权限授予U5用户,
--并允许他再将此权限授予其他用户
grant Insert on SC to U2 with grant option;

--4.6
create user U6 without login;
GRANT INSERT
ON SC
TO U6
WITH GRANT OPTION;
--4.7
create user U7 without login;
GRANT INSERT
ON SC
TO U7;
--回收权限
--4.8] 把用户U4修改学生学号的权限收回
revoke update(sno) on Student from U4;

--4.9] 收回所有用户对表SC的查询权限
revoke select on SC from public;

--4.10] 把用户U5对SC表的INSERT权限收回
revoke insert on SC from U5 cascade;
/*系统只收回直接或间接从U5处获得的权限 */

边栏推荐
- centos7下安装mysql,网上文章都不太准
- 2021-10-13arx
- Guangzhou metro line 14 xinshixu station is under construction, and residents in Baiyun District are about to start a double line transfer mode!
- Ie compatibility problem handling
- Multithreading and high concurrency (III) -- source code analysis AQS principle
- Continue to write the greatest work based on modelarts [play with Huawei cloud]
- Pl/sql server syntax explanation
- Summary of key points of bank entry examination
- Detailed explanation of super complete knowledge points of instruction system
- Voice chat app - how to standardize the development process?
猜你喜欢

初识SuperMap iDesktop

Get to know SuperMap idesktop for the first time

IDEA打包jar包及运行jar包命令

Typora tutorial

巧用ngx_lua做流量分组

Digital transformation scheme of real estate: all-round digital intelligence system operation, helping real estate enterprises improve the effectiveness of management and control

Sword finger offer

7. Dichotomy -- find a set of repeated or ordered but rotating arrays

第一篇:UniAPP的小程序跨端开发-----创建uniapp项目
![[wechat applet] project practice - lottery application](/img/7b/a0545f077259b3dc971dc246813177.png)
[wechat applet] project practice - lottery application
随机推荐
6、双指针——递增数组两数之和与目标数相等
Kubernetes
(1) Summary of machine learning concepts
Differences among pipes, pipe passes and pipe States
配置树莓派,过程和遇到问题
集群为什么需要root权限
14、双指针——盛最多水的容器
网易笔试之不要二——欧式距离的典型应用
2021-10-13arx
银行入职考试要点汇总
Skillfully use NGX_ Lua makes traffic grouping
IE兼容性问题处理
Install MySQL under centos7, and the online articles are not accurate
4. Adjust the array order so that odd numbers precede even numbers
brief introduction
10分钟快速入门EVS【玩转华为云】
Database mysql Foundation
排序——快速排序(快慢指针实现)
Xu Ziyang, President of ZTE: 5nm chip will be launched in 2021
What are the advantages of MRO purchasing website for industrial products? One article will help you understand