资源预览内容
第1页 / 共6页
第2页 / 共6页
第3页 / 共6页
第4页 / 共6页
第5页 / 共6页
第6页 / 共6页
亲,该文档总共6页全部预览完了,如果喜欢就下载吧!
资源描述
实验题目:数据库安全性与完整性控制目录一、实验目的.1二、实验内容.1三、实验要点及说明1四、实现方法.1五、实验结果2六、源程序清单4七、思考及总结5一、实验目的通过本次实验,提高以下几个方面的能力1. 创建新用户2. 通过GRANT语句对新用户进行授权3. 通过REVOKE语句完成权限的回收4. 实体完整性的实现5. 参照完整性实现二、实验内容1. 完成教材中实例182. 完成教材中相应于完整性的实例。三、实验要点及说明1. 一定要熟练掌握GRANT语句与REVOKE语句的使用2. 一定要熟练掌握实体完整性与参照完整性控制3. 要读懂出错的提示信息四、实现方法未将创建的用户删除,有创建同一个用户。删除localhost方法nys(il dpap usep * lisiJ locaLhost- ;Quer-y OK. 0 rows affected 五、实验结果QiieFy OK, 0 rows affected nysql Create user J ahangsanJ J identif ied 坷 J; UiieriF OK, 0 rows affected mysql Create user 1zhangsan2f Xf identified by password 1 *E6CC9BBS78B948C35E9 2B003C792C46C58C4AF40J; Wuei-y OK, 0 rows affected mysql Grant all on *_ * to 1 lisif PJ localhostf identif ied by J 2J ;Muery OK, 0 rows affected mysql show schenas; +! Database!i informatierschema ! irtisqliI performance_schema !I test!|4 rows in set S.02 sec)创建用户成功Microsoft Windows XP5.1.2600 版权所有 1985-2001 Microsoft Corp.C: Ducuinents and Sett ingsSUdministpatOFnysql -u aliancjsan pEnter password: *Welcoune to the MySQL monitoi*. Commands end uith ; of g.Volip MySQL connection id is 4Server version: 5.5.8-enterpiise-connepcialadvanced HySQL Enterprise Server H duanced Edition Copyiicfht 2000, 2010. Oracle and/oi its aff iliates. All rights reserved.Opacle is a registered tradenark of Oracle Gorporation and/or its affiliates. Other names maji be tFadenarPs of their respect iue owneis aType 1 he Ip ;J or J liJ fop he Ip. Type J XcJ to clear the current input statement - nysql登陆用户zhangsanHicrosoft Windows XP5-1.2600 CC 版杈所有 1985-2001 Microsoft Carp.C: XDocuments and S e 11 in cf s A dm in is t r at of m i/s q 1 -u zhangsan2 -pEnter password: *Me leone to the MySQL nonitop- Connands end with ; or g.Voiir MySQL connection id is 5Server yers ion : 5 - 5. S-enterprise-CDUimepo ialadvanced MySQL Enterprise Server 一 A duanced Edit ion CCofiinercialCopyright 2Q0&, 2010, OracLe and/or its affiliates. All rights reserved.Uracle is a registered tpademapk of Oracle Corporation and/or its af f iliates - Otliei ruames ma.y be trademarks of their respect iue owners.Iype * he Ip;J or X1F fop he Ip. Type * ScJ to clear the current input statement.mysql登陆用户zhangsan2Microsoft Uindous XP 版本 5.1.2600 扳权所有 1985-2001 Microsoft Copp.C: XDocunients and Sett injfs fldmin ist rat or mysql -li lisi -pEnter Dftssword: *Weleone to the MySQL nonitor- Commands end with ; of gYour Nt/SQL connection id is &Seruep vers ion: 5.5.8-enterprise-comiiepcial-aduanced HySQL Enterprise Server 一 A dvanced Edition CCommercialCopyright 20DD. 2010, Oracle and/or its affiliates. All rights reserued.Orac le is a peejistered trade nark of Orac le Corparat ion and/or its aff iliates. Other names may be tradenarJcs of their respective ov/ners .Type help; or J / for help. Type Jcf to clear the curpent input statement.mysql登陆用户lisiii9sql show schemas; +I DatabaseIri5rs:qL show schemas ; 1_I DatabaseII inf ormat ion_sclienia I -ik1 row in set ! inFopmation_schema! ch4I nysqlI perf ornance_scliena! test5 rous in set 用户lis i信息显示用户zhangsan和 zhangsan 2信息显示niiFsql grant se lect an ch4.t to s hangs an ; Query OK, & rows affected CS.S2 secmysql gpant seLectCcoll an ch4_t to zhangsanS; Query OK, 8 pows affected CS.S0 sec分别给用户zhangsan和zhangsan2授权imys(il show schenas ;H+Database!_i+Iinf omat ionscliena !1 ch4!_i+2 1ows in set grant update an ch4.t to ahanysanS; Quer OK, S r-ous affected CO.09 sechysql update cM.tI - set coll=1;ftu.ery OK, S rows affected (0.02 s:ec:Ro us: matched: S Changed: 0= 0修改zhangsan 2中数据六、源程序清单Create user zhangsan% identified by 1;/* 创建用户张三,密码为 1*/Create user zhangsan2% identified by password *E6CC90B878B948C35E92B003C792C46C58C4AF40;/* 创建用户张三,密文定义密码为1*/Grant all on *.* to lisilocalhost identified by 2;/* 创建用户李四 */ mysql -u zhangsan -p /* 登录用户张三*/ show schemas;/* 显示信息*/grant select on ch4.t to zhangsan;/* 给用户张三授权*/update ch4.t set col1=1;/* 修改张三2 中的信息*/七、思考及总结重复创建用户,对代码掌握不熟悉,混淆记忆。
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号