文档详情

MySQL数据库基础与实践 第2版 课后习题答案 CH09 课后习题答案.docx

发布:2025-02-26约1.24千字共2页下载文档
文本预览下载声明

MySQL数据库基础与实践

PAGE2

STYLEREF\n标题1错误!文档中没有指定样式的文字。STYLEREF标题1错误!文档中没有指定样式的文字。

PAGE16

第9章事件和数据管理

实践与练习答案

1.填空题

(1)GLOBALevent_scheduler

(2)事件

(3)createuser

(4)revoke

2.选择题

(1)D

(2)B

(3)A

(4)A

(5)C

(6)A

(7)B

(8)A

(9)A

(10)D

3.概念题

(1)查看用户的语法格式如下:

select*frommysql.user

wherehost=’host_name’anduser=’user_name’

删除用户的语法:

使用dropuser语句可以删除普通用户,dropuser语句删除用户必须有dropuser权限,语法规则如下:

dropuseruser[,user]…

(2)

使用mysqladmin命令来修改密码,语法规则如下:

mysqladmin-uusernameppassword

password为关键字

使用set语句来修改密码,语法规则如下:

setpassword[for’username’@’hostname’]=password(‘new_password’);

如果不加[for’username’@’hostname’],则表明修改当前用户密码,如果加了[for’username’@’hostname’],则表明修改当前主机上的特定用户的密码。

(3)给予用户授权可以使用grant语句,语法格式如下:

grant

priv_type[(column_list)][,priv_type[(column_list)]]…

on[object_type]priv_level

touser_specification[,user_specification]…

[withwith_option…]

(4)当需要撤销一个用户的权限,但不从user表中删除该用户,可以使用revoke语句,语法格式如下:

revokepriv_type[(column_list)][,priv_type[(column_list)]]…

on[object_type]priv_level

fromuser[,user]…

或者

revokeallprivieges,grantoption

fromuser[,user]…

4.操作题

selectcurdate(),current_date(),curtime(),current_time(),now(),

current_timestamp(),localtime(),sysdate()\G

显示全部
相似文档