


下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、MySQL 授权 grant 与撤销权限 revoke 语法的详细解析以下的文章是 MySQL grant 语法的详细解析,如果你对 MySQL grant 语法的相关的实际操作有兴趣的话,你就可以对以下的文章点击观看了。我们大家都知道 MySQL 数据库赋予用户权限命令的简单格式可 概括为:grant 权限 on 数据库对象 to 用户一、grant 普通数据用户,查询、插入、更新、删除 数据库中所有表数据的权利。1. grant select on testdb.* to common_user%2. grant insert on testdb.* to common_user%3. g
2、rant update on testdb.* to common_user%4. grant delete on testdb.* to common_user%或者,用一条 MySQL 命令来替代:1. grant select, insert, update, delete on testdb.* to common_user%二、grant 数据库开发人员,创建表、索引、视图、存储过程、函数。等权限。grant 创建、修改、删除 MySQL 数据表结构权限。1. grant create on testdb.* to developer192.168.0.%;2. grant alte
3、r on testdb.* to developer192.168.0.%;3. grant drop on testdb.* to developer192.168.0.%;MySQLgrant 操作 MySQL 外键权限。grant references on testdb.* to developer192.168.0.%;grant 操作 MySQL 临时表权限。grant create temporary tables on testdb.* togrant 操作 MySQL 索引权限。grant index on testdb.* togrant 操作 MySQL 视图、查看视图源
4、代码 权限。1. grant create view on testdb.* to developer192.168.0.%;2. grant show view on testdb.* to developer192.168.0.%;grant 操作 MySQL 存储过程、函数 权限。1. grant create routine on testdb.* to developer192.168.0.%; -now, can show procedure status2. grant alter routine on testdb.* to developer192.168.0.%; - no
5、w, you can drop a procedure3. grant execute on testdb.* to developer192.168.0.%;三、grant 普通 DBA 管理某个 MySQL 数据库的权限。MySQLgrant all privileges on testdb to其中,关键字 “ privileges ” 可以省略。1. grant execute on procedure testdb.pr_add to dbalocalhost2. grant execute on function testdb.fn_add to dbalocalhost3. gr
6、ant all on *.* to dbalocalhost五、MySQL grant 权限,分别可以作用在多个层次上。1. grant 作用在整个 MySQL 服务器上:grant select on *.* to dbalocalhost; - dba可以查询 MySQL 中所有数据库中的表。grant all on *.* to dbalocalhost; - dba可以管理 MySQL 中的所有数据库2. grant 作用在单个数据库上:grant select on testdb.* to dbalocalhost; - dba可以查询 testdb 中的表。3. grant 作用在
7、单个数据表上:grant select, insert, update, delete on testdb.orders to4. grant 作用在表中的列上:grant select(id, se, rank) on testdb.apache_log to5. MySQL grant 作用在存储过程、函数上:1. grant execute on procedure testdb.pr_add to dbalocalhost2. grant execute on function testdb.fn_add to dbalocalhost六、查看 MySQL 用户权限查看当前用户(自己)
8、权限:show grants;查看其他 MySQL 用户权限:show grants for dbalocalhost;七、撤销已经赋予给 MySQL 用户权限的权限。revoke 跟 grant 的语法差不多,只需要把关键字 “ to ” 换成“ from ” 即可:1. grant all on *.* to dbalocalhost;2. revoke all on *.* from dbalocalhost;八、MySQL grant 、 revoke 用户权限注意事项1. grant, revoke 用户权限后,该用户只有重新连接 MySQL 数据库,权限才能生效。2. 如果想让授权的用户,也可以将这些权限 My
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年12月专升本计算机模拟试题(含参考答案)
- 2025年1月专职安全生产管理人员综合类C证练习题含参考答案
- 重难点解析人教版八年级上册物理《声现象》定向练习试卷(附答案详解)
- 2025及未来5年中国九抽屉市场调查、数据监测研究报告
- 2025及未来5年中国直流接触器市场调查、数据监测研究报告
- 2025及未来5年中国饮料货架市场调查、数据监测研究报告
- 2025及未来5年中国单杆市场调查、数据监测研究报告
- 2025及未来5年中国荷兰豆市场调查、数据监测研究报告
- 考点解析-人教版八年级《力》专题练习试卷(含答案解析)
- 解析卷人教版八年级上册物理《声现象》定向训练试题(含解析)
- 10胃十二指肠溃疡临床路径表单
- 高标准农田施工组织设计(全)
- 5-4、MSSP - SOTAR - 泰康人寿 5-4、MSSP - SOTAR - 泰康人寿
- 小餐饮备案承诺书(样式)
- 学法减分100道题题库及答案(驾驶证学法减分学法免分题库及答案)
- 《安娜·卡列尼娜》-课件-
- 道路交通安全知识培训(经典)-课件
- 2022年新版体系文件药品零售单体连锁总部质量管理体系文件
- 校服登记表模板
- 【高等数学练习题】南京信息工程大学专升本自考真题汇总(附答案解析)
- DB11-T 1382-2022空气源热泵系统应用技术规程
评论
0/150
提交评论