第一范文网 - 专业文章范例文档资料分享平台

数据库学习入门数据库基础入门

来源:用户分享 时间:2025/5/30 5:24:59 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

添加用户 mysql> use mysql

mysql> insert into

user(host,user,password)values('localhost','test', password('222222'));

mysql> flush privileges;

授权:grant all on *.* to 'test'@'localhost'identified by '222222'

grant select on stus.* to 'test'@'localhost'identified by '121212'

grant privileges(columns)

privileges表示授予的权限,columns表示作用的列(可选) on what

设置权限级别:全局级、数据库级、表级、列级 to account

权限授予的用户:用'user _name'@'host_name'这种用户名、主机名格式、identified by 'password'设置密码 privileges有哪些 alter 修改表和索引 create 创建数据库和表 delete 删除表中以有的记录 drop 删除数据库和表 inde 创建和删除索引 insert 向表中插入数据 select 检索表中的数据、 update 修改表中的记录

file 读写服务器上的数据

process 查看服务器中执行的线程信息或杀死线程 reload 重载授权表或清空日志、主机缓存或表缓存 shutdown 关闭服务器 all 所有权限 revoke取消授权

mysql>revoke privileges(columns)on what from account;

注:revoke可删除权限,但不能删除帐号,即使帐号已经没有任何权限。所以user数据表里还会有该帐号的记录,要彻底删除帐号,需使用delete命令手工删除user表中的相关数据。 示例:

revoke all on *.*from'test'@'localhost'; delete from user where user='test'; 细节权限的分配与撤销

grant select,delete,update on

student,test.*to'erich'@'localhost'identified by 'test' 运行结果是,erich用户只能通过‘test‘密码从本机访问student,test数据库,并且没有insert权限 revoke select,delete,update on student.*from'erich'@'localhost';

运行结果是,将erich用户在student数据库中的select,delete,update权限撤销

搜索更多关于: 数据库学习入门数据库基础入门 的文档
数据库学习入门数据库基础入门.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c4k30299deg0ne2d1fb34_6.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top