版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、實驗題目:數(shù)據(jù)庫安全性與完整性控制目錄一、實驗?zāi)康?.二、實驗內(nèi)容1.三、實驗要點及說明四、實現(xiàn)方法1.五、實驗結(jié)果2.六、源程序清單 2.七、思考及總結(jié)6.、實驗?zāi)康耐ㄟ^本次實驗,提高以下幾個方面的能力1. 創(chuàng)建新用戶2. 通過 GRANT 語句對新用戶進行授權(quán)3. 通過 REVOKE 語句完成權(quán)限的回收4. 實體完整性的實現(xiàn)5. 參照完整性實現(xiàn)二、實驗內(nèi)容1. 完成教材中實例 1 82. 完成教材中相應(yīng)于完整性的實例。三、實驗要點及說明1. 一定要熟練掌握GRANT語句與REVOKE語句的使用2. 一定要熟練掌握實體完整性與參照完整性控制3. 要讀懂出錯的提示信息四、實現(xiàn)方法mysql g
2、rant all privileges - on table student,course- to u3;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near course to u3 at line 2只能給一個表授權(quán)mysql grant insert- on table sc- with grant option;ERROR 1064 (
3、42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near grant option at line 3不能定義可授權(quán)用戶五、實驗結(jié)果mysql create user u1% identified by 1;Query OK, 0 rows affected (0.00 sec) mysql create user u2% identified by 2;Query OK
4、, 0 rows affected (0.00 sec) mysql create user u3% identified by 3;Query OK, 0 rows affected (0.00 sec) mysql create user u4% identified by 4;Query OK, 0 rows affected (0.01 sec) mysql create user u5% identified by 5;Query OK, 0 rows affected (0.00 sec) mysql create user u6% identified by 6;Query OK
5、, 0 rows affected (0.00 sec) mysql create user u7% identified by 6;Query OK, 0 rows affected (0.00 sec) mysql create user u8% identified by 8;Query OK, 0 rows affected (0.00 sec) mysql select user, host, password from mysql.user;+ +| user | host| password |+ +| root | localhost | *E74858DB86EBA20BC3
6、3D0AECAE8A8108C56B17FA | u3 | %| *C4E74DDDC9CC9E2FDCDB7F63B127FB638831262E | u2| %| u1| %| u4| %| u5| %| u6| %| u7| %| u8| %+| *12033B78389744F3F39AC4CE4CCFCAD6960D8EA0 | *E6CC90B878B948C35E92B003C792C46C58C4AF40 | *908BE2B7EB7D7567F7FF98716850F59BA69AA9DB | *7534F9EAEE5B69A586D1E9C1ACE3E3F9F6FCC446
7、 | *C3AB9ECDF746570BBF9DCAA9DB3586D25956DC93 | *C3AB9ECDF746570BBF9DCAA9DB3586D25956DC93 | *6AF37A8C78E3A957D16D98F12788D1CFB2987A4C |9 rows in set (0.00 sec) mysql drop user u7%;Query OK, 0 rows affected (0.00 sec) mysql select user, host, password from mysql.user;+ +| user | host | password+ +| ro
8、ot | localhost | *E74858DB86EBA20BC33D0AECAE8A8108C56B17FA| u3| %| *C4E74DDDC9CC9E2FDCDB7F63B127FB638831262E| u2| %| *12033B78389744F3F39AC4CE4CCFCAD6960D8EA0| u1| %| *E6CC90B878B948C35E92B003C792C46C58C4AF40| u4| %| *908BE2B7EB7D7567F7FF98716850F59BA69AA9DB| u5| %| *7534F9EAEE5B69A586D1E9C1ACE3E3F9
9、F6FCC446| u6| %| *C3AB9ECDF746570BBF9DCAA9DB3586D25956DC93| u8| %| *6AF37A8C78E3A957D16D98F12788D1CFB2987A4C+8 rows in set (0.00 sec)mysql grant select- on table student- to u1;ERROR 1046 (3D000): No database selectedmysql use ch3;Database changedmysql grant select- on table student- to u1;Query OK,
10、 0 rows affected (0.00 sec)mysql grant all privileges- on table course- to u3;Query OK, 0 rows affected (0.00 sec)mysql grant update(sno),select- on table student- to u4;Query OK, 0 rows affected (0.00 sec)mysql grant insert- on table sc- to u5- with grant option;Query OK, 0 rows affected (0.00 sec)
11、mysql grant insert- on table sc- to u6;Query OK, 0 rows affected (0.00 sec)mysql show grants;+| Grants for rootlocalhost|+| GRANT ALL PRIVILEGES ON *.* TO rootlocalhost IDENTIFIED BY PASSWORD *E74 858DB86EBA20BC33D0AECAE8A8108C56B17FA WITH GRANT OPTION | GRANT PROXY ON TO rootlocalhost WITH GRANT OP
12、TION|+2 rows in set (0.00 sec)mysql show grants for u1;+| Grants for u1%|+| GRANT USAGE ON *.* TO u1% IDENTIFIED BY PASSWORD *E6CC90B878B948C35E92B003C792C46C58C4AF40 | GRANT SELECT ON ch3.stude nt TO u1%|+2 rows in set (0.00 sec)mysql revoke select- on student- from u1;Query OK, 0 rows affected (0.
13、00 sec)mysql show grants for u1;+| Grants for u1%|+PASSWORD| GRANT USAGE ON *.* TO u1% IDENTIFIED BY *E6CC90B878B948C35E92B003C792C46C58C4AF40 |+1 row in set (0.00 sec)mysql create table student(- sno char(9) primary key,- sname char(8) not null,- ssex char(2) check(ssex in(男,女),- sage smallint,- sd
14、ept char(20)- );Query OK, 0 rows affected (0.09 sec)mysql create table student1(- sno char(9) primary key,- sname char(8) not null,- ssex char(2) ,- sage smallint,- sdept char(20)- ,- check(ssex=女or sn ame not like Ms.%)- );Query OK, 0 rows affected (0.08 sec)mysql create table student2(- sno numeri
15、c(6)- constraint c1 check (sno between 90000 and 99999),- sname char(20)- constraint c2 not null,- sage numeric(3)- constraint c3 check (sage ssex char(2)- constraint c4 check (ssex in( 男 ,女),- constraint skey primary key (sno)- );Query OK, 0 rows affected (0.02 sec)mysql alter table student2- drop constraint c1;六、源程序清單mysql grant all privileges- on table student,course- to u3;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near course to u3 at line 2只能給一個表授權(quán)mysql gran
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 修補瓷磚方法與步驟
- 采購業(yè)務(wù)代理機構(gòu)備案情況表
- 共創(chuàng)品牌合作協(xié)議書模板
- 代發(fā)合作協(xié)議書范本模板
- 農(nóng)村建房的鄰居協(xié)議書模板
- 辦公室租用協(xié)議書模板
- 嬰童服飾購買習(xí)慣問卷調(diào)查
- 家庭居民泡腳習(xí)慣及泡腳產(chǎn)品使用情況的調(diào)查問卷
- 成功營業(yè)營運指導(dǎo)培訓(xùn)課件
- 2024年復(fù)合微生物肥料項目合作計劃書
- 第一單元測試卷-2024-2025學(xué)年統(tǒng)編版語文四年級上冊
- DB32∕T 3217-2017 公路工程EPS顆?;旌陷p質(zhì)材料路堤技術(shù)規(guī)程
- 2024年全國職業(yè)院校技能大賽高職組(智能網(wǎng)聯(lián)汽車技術(shù)賽項)考試題庫(含答案)
- 2024年二手房購房定金合同范例(三篇)
- 新一代物流無人機運營模式及管理體系構(gòu)建方案
- 中學(xué)生心理健康培訓(xùn)課件
- 2024年高級裝配鉗工職業(yè)鑒定考試題庫-下(判斷題)
- 新入職工入職安全培訓(xùn)考試題【各地真題】
- 中考作文指導(dǎo):五大核心萬能作文素材
- 2024年全國中級注冊安全工程師之安全生產(chǎn)法及相關(guān)法律知識考試經(jīng)典測試題(附答案)
- 100以內(nèi)兩位數(shù)進位加法退位減法計算題-(直接打印版)
評論
0/150
提交評論