当前位置:网站首页>数据库安全 --- 创建登录名 用户+配置权限【笔记】
数据库安全 --- 创建登录名 用户+配置权限【笔记】
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处获得的权限 */

边栏推荐
猜你喜欢

Aqua Data Studio 18.5.0导出insert语句

What kind of knowledge payment system functions are more conducive to the development of the platform and lecturers?

14、双指针——盛最多水的容器

It's settled! On July 30!

15、判断二维数组中是否存在目标值

利用正则表达式从文件路径中匹配文件名

【微信小程序】项目实战—抽签应用

14. Double pointer - the container that holds the most water

第一篇:UniAPP的小程序跨端开发-----创建uniapp项目

配置树莓派,过程和遇到问题
随机推荐
什么样的知识付费系统功能,更有利于平台与讲师发展?
按位与、或、异或等运算方法
PHP generates QR code (learning)
阿里云镜像地址
集群为什么需要root权限
leetcode076——数组中的第 k 大的数字
CGAL编译错误
印度计划禁用中国电信设备!真离得开华为、中兴?
uni-app进阶之生命周期
7、二分法——寻找一组重复或者有序但是旋转的数组
(1)机器学习概念总结
Ie compatibility problem handling
Oracle中的小知识
16、字符串反转
Qt | 信号和槽的一些总结
10、链表中倒数第k个节点
10 minute quick start EVs [play Huawei cloud]
Leetcode076 -- the kth largest number in the array
字符串匹配
C语言 二级指针详解及示例代码