当前位置:网站首页>Database security - create login user + configure permissions [notes]

Database security - create login user + configure permissions [notes]

2022-07-28 10:24:00 Hard work Zhang Zhang

Project scenario :

Create and authorize users


Solution :

1、 Create user
 Insert picture description here

 Insert picture description here
 Insert picture description here

 Insert picture description here

 Insert picture description here

 Insert picture description here
 Insert picture description here
 Insert picture description here
At this point, the user was successfully created :
 Insert picture description here
2、 Configure permissions
 Insert picture description here

Put the inquiry Student Table permissions are granted to users test:

 Insert picture description here

Put right Student Table and Course All permissions for the table are granted to the user U2 and U3

-- Put the inquiry Student Table permissions are granted to users test
grant select on Student to test;

 Insert picture description here

problem 2:all privilege Can not use ?

-- Put right Student Table and Course All permissions for the table are granted to the user test and U1
grant all 
 on Student to test,U1;
 grant all 
 on Course to test,U1;

 Insert picture description here

 -- Check the watch SC The query permission of is granted to all users 
 grant select on SC to public;

 Insert picture description here

 -- Put the inquiry Student Table and modify student ID rights granted to users U1
  grant select,update(sno) on SC to U1;

 Insert picture description here
3、 Create user name

-- Create login , Create user 
create login zff with password='***',DEFAULT_DATABASE=STU1;
-- to zff Login to create a user U2
create user U2 for login zff;
-- Create a user without a login , Can not login , But can be granted permission 
create user U3_none without login;

4、 Configure permissions for relevant users

--4.5  Check the watch SC Of INSERT Authority granted to U5 user ,
-- And allow him to grant this permission to other users 
grant Insert on SC to U2 with grant option;

 Insert picture description here


--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;
-- Recycling permissions 
--4.8]  Put the user U4 The authority to modify the student number is withdrawn 
revoke update(sno) on Student from U4;

 Insert picture description here

--4.9]  Take back all user pairs SC The query authority of 
revoke select on SC from public;

 Insert picture description here

--4.10]  Put the user U5 Yes SC Tabular INSERT Withdrawal of authority 
revoke insert on SC from U5 cascade;
/* The system only retracts directly or indirectly from U5 Access to  */

 Insert picture description here

原网站

版权声明
本文为[Hard work Zhang Zhang]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/209/202207281011580196.html