试验四数据库安全性与完整性控制1

上传人:ai****ue 文档编号:53009533 上传时间:2022-02-09 格式:DOCX 页数:7 大小:12.01KB
收藏 版权申诉 举报 下载
试验四数据库安全性与完整性控制1_第1页
第1页 / 共7页
试验四数据库安全性与完整性控制1_第2页
第2页 / 共7页
试验四数据库安全性与完整性控制1_第3页
第3页 / 共7页
资源描述:

《试验四数据库安全性与完整性控制1》由会员分享,可在线阅读,更多相关《试验四数据库安全性与完整性控制1(7页珍藏版)》请在装配图网上搜索。

1、实验题目:数据库安全性与完整性控制目录一、实验目的1.二、实验内容1.三、实验要点及说明1.四、实现方法1.五、实验结果2.六、源程序清单 2.七、思考及总结6.、实验目的通过本次实验,提高以下几个方面的能力1 .创建新用户2 .通过GRANT语句对新用户进行授权3 .通过REVOKE语句完成权限的回收4 .实体完整性的实现5 .参照完整性实现二、实验内容1 .完成教材中实例1 82 .完成教材中相应于完整性的实例。三、实验要点及说明1 .一定要熟练掌握GRANT语句与REVOKE语句的使用2 . 一定要熟练掌握实体完整性与参照完整性控制3 .要读懂出错的提示信息四、实现方法mysql gra

2、nt all privileges - on table student,course- to u3;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near course to u3 at line 2只能给一个表授权mysql grant insert- on table sc- with grant option;ERROR 1064 (420

3、00): You have an error in your SQL syntax; check the manual thatcorresponds to your MySQL server version for the right syntax to use near grantoption at line 3不能定义可授权用户五、实验结果mysql create user u1% identified by 1;Query OK, 0 rows affected (0.00 sec)mysql create user u2% identified by 2;Query OK, 0 ro

4、ws 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, 0 rows a

5、ffected (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 | *E74858DB86EBA20BC33D0AECAE8A8108c56

6、B17FA | u3 | %| *C4E74DDDC9CC9E2FDCDB7F63B127FB638831262E | u2| %|*12033B78389744F3F39AC4CE4CCFCAD6960D8EA0 | u1| %|*E6CC90B878B948C35E92B003C792C46C58C4AF40 | u4| %|*908BE2B7EB7D7567F7FF98716850F59BA69AA9DB | u5| %|*7534F9EAEE5B69A586D1E9C1ACE3E3F9F6FCC446 | u6| %|*C3AB9ECDF746570BBF9DCAA9DB3586D25

7、956DC93 | u7| %|*C3AB9ECDF746570BBF9DCAA9DB3586D25956DC93 | u8| %|*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+| root | localhost | *E74858DB86EB

8、A20BC33D0AECAE8A8108C56B17FAu3| %| *C4E74DDDC9CC9E2FDCDB7F63B127FB638831262Eu2| %| *12033B78389744F3F39AC4CE4CCFCAD6960D8EA0u1| %| *E6CC90B878B948C35E92B003C792C46C58C4AF40u4| %| *908BE2B7EB7D7567F7FF98716850F59BA69AA9DBu5| %| *7534F9EAEE5B69A586D1E9C1ACE3E3F9F6FCC446u6| %| *C3AB9ECDF746570BBF9DCAA9

9、DB3586D25956DC93u8| %+| *6AF37A8C78E3A957D16D98F12788D1CFB2987A4C 8 rows in set (0.00 sec) mysql grant select- on table student- to u1;ERROR 1046 (3D000): No database selected mysql use ch3;Database changed mysql grant select- on table student- to u1;Query OK, 0 rows affected (0.00 sec) mysql grant

10、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) mysql grant insert- on table sc- to

11、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 OPTION | +2 rows in set (0.00 se

12、c) mysql show grants for u1; + | Grants for u1% | +| GRANT USAGE ON *.* TO u1% IDENTIFIED BY PASSWORD *E6CC90B878B948C35E92B003C792C46C58C4AF40 | | GRANT SELECT ON ch3.student TO u1% |+2 rows in set (0.00 sec)mysql revoke select- on student- from u1;Query OK, 0 rows affected (0.00 sec)mysql show gra

13、nts for u1; +| Grants for u1% I+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,- sdept char(20)- );Quer

14、y 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 sname not like Ms.%)- );Query OK, 0 rows affected (0.08 sec)mysql create table student2(- sno numeric(6)- constraint c1 c

15、heck (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;六、源程序清单my

16、sql 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 只能给一个表授权mysql grant insert- on table sc- with grant option;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 grant option at line 3 不能定义可授权用户七、思考及总结在实验中代码很是困难。我会多加练习的

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!