MySQL数据库实验七 MySQL安全管理

一、实验项目:

MySQL安全管理。

二、实验目的

掌握用户管理和权限控制的方法。

三、实验内容

1、创建petstore数据库管理用户a0001、店员用户s0001和顾客用户u0001,密码均为123456。

create user
a0001@localhost identified by '123456',
s0001@localhost identified by '123456',
u0001@localhost identified by '123456';

2、将用户a0001的密码改为admin123。

update mysql.user set password=PASSWORD('admin123') where user='a0001';

或者

update mysql.user set authentication_string=PASSWORD('admin123') where user='a0001';

3、授予用户u0001对petstore库中product表有select操作权限。

grant select on product to u0001@localhost;
Show grants for u0001@localhost;

4、授予用户u0001对petstore库中account表的姓名列和地址列有UPDATE权限。

grant update(fullname,address)on account to u0001@localhost;
Show grants for u0001@localhost;

5、授予用户a0001对所有库都有所有操作权限 。

grant all on *.* to a0001@localhost;
Show grants for a0001@localhost;

6、授予用户s0001对petstore库中所有表有select操作权限,并允许其将该权限授予其他用户。

grant select on petstore.* to s0001@localhost with grant option;
Show grants for s0001@localhost;

7、收回用户u0001对petstore库中account表上的UPDATE操作权限。

revoke update on petstore.account from u0001@localhost;
Show grants for u0001@localhost;
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Meteor.792

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值