實(shí)驗(yàn)?zāi)康模?/p>
- 掌握混合模式下數(shù)據(jù)庫(kù)用戶帳號(hào)的建立與取消方法;
- 掌握數(shù)據(jù)庫(kù)用戶權(quán)限的設(shè)置方法;
- 掌握服務(wù)器角色的用法;
-
掌握SQL-Server中數(shù)據(jù)庫(kù)備份和恢復(fù)的方法。
?1、數(shù)據(jù)安全性。以系統(tǒng)管理員身份登錄到SQL Server服務(wù)器,在SQL Server界面中實(shí)現(xiàn)以下操作,并寫出相應(yīng)程序代碼。
1)在當(dāng)前計(jì)算機(jī)中增加一個(gè)用戶zhang,密碼為secret。使此用戶通過(guò)windows模式下登錄SQL Server服務(wù)器,登錄名為zhang;
(本人使用的筆記本,手動(dòng)在計(jì)算機(jī)中創(chuàng)造新用戶zhang)
點(diǎn)擊【開(kāi)始】——點(diǎn)擊【設(shè)置】——【賬戶】
——【家庭和其他用戶】
——【添加賬戶】 ——【沒(méi)有登錄信息】——【添加沒(méi)有MIcrosoft賬戶的用戶】
?——【添加用戶zhang】
?返回電腦桌面【開(kāi)始】
?
將用戶切換為zhang——打開(kāi)Sqlserver? management? studio如圖——成功
(下部分實(shí)驗(yàn)本人不再進(jìn)行修改,作為實(shí)驗(yàn)思路參考)
2)新建以混合模式登錄SQL Server服務(wù)器的用戶登錄名分別為stu1、stu2和stu3登錄密碼為secret,默認(rèn)登錄數(shù)據(jù)庫(kù)為stu;將登錄帳號(hào)stu1、stu2和stu3加入到服務(wù)器角色sysadmin中;?
(以stu1為例,stu2,3過(guò)程相同)
?
?
3)刪除服務(wù)器角色sysadmin的成員stu2和stu3;
因?yàn)閷?duì)于服務(wù)器角色右擊sysadmin沒(méi)有屬性選項(xiàng),
則在stu2,stu3登錄屬性中手動(dòng)勾選刪除。
?
?
4)在數(shù)據(jù)庫(kù)stu中創(chuàng)建用戶zhang,登錄帳號(hào)為zhang;
新建查詢需要在student數(shù)據(jù)庫(kù)里:
?
create?user?zhang for?login?[LAPTOP-9554HU99\zhang]
(這是我實(shí)驗(yàn)過(guò)程的用戶主機(jī)以及賬戶,實(shí)驗(yàn)中以本人主機(jī)為準(zhǔn))
5)在數(shù)據(jù)庫(kù)stu中創(chuàng)建用戶stu1、stu2和stu3,登錄帳號(hào)為stu1、stu2和stu3;
CREATE??USER??stu1 for?login?stu1
CREATE??USER??stu2?for?login?stu2
CREATE??USER??stu3?for?login?stu3
6)給數(shù)據(jù)庫(kù)用戶zhang賦予創(chuàng)建數(shù)據(jù)表的權(quán)限;
GRANT???create??table??to?zhang
7)給數(shù)據(jù)庫(kù)用戶stu1賦予對(duì)sc表進(jìn)行插入、修改、刪除操作權(quán)限;
GRANT?insert,update,delete?ON??XSKC.sc to?stu1
8)給數(shù)據(jù)庫(kù)用戶stu2和stu3賦予對(duì)student表、course表所有操作權(quán)限及查詢sc的操作權(quán)限,并允許再授權(quán)給其他用戶;
student表:文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-460988.html
grant?all?privileges
on?XSKC.student
to?stu2,stu3
with?grant?option
course表:
grant?all?privileges
on?XSKC.course
to?stu2,stu3
with?grant?option
Sc:
grant?select
on?XSKC.sc
to?stu2,stu3
with?grant?option
9)回收數(shù)據(jù)庫(kù)用戶stu2對(duì)student表和course表的刪除操作的權(quán)限;?
student表:
revoke?delete
on?XSKC.student
from?stu2
Cascade
course表:文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-460988.html
revoke?delete
on?XSKC.course
from?stu2
Cascade
到了這里,關(guān)于數(shù)據(jù)庫(kù)實(shí)驗(yàn)六:數(shù)據(jù)庫(kù)系統(tǒng)安全的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!