MySQL权限篇之GRANT OPTION
来源:互联网 发布:美式英语口语软件下载 编辑:程序博客网 时间:2024/06/11 06:02
GRANT OPTION,用户被授予了某个权限,那么默认情况下,该用户是不能把这个权限授予给其他人的。
但是可以使用WITH GRANT OPTION这个子句来让该用户可以将权限再授予给其他人。比如:
mysql> grant update on cms.t_account to 'ut01'@'%' with grant option;
Query OK, 0 rows affected (0.06 sec)
mysql> show grants for 'ut01'@'%';
+---------------------------------------------------------------------------+
| Grants for ut01@% |
+---------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'ut01'@'%' |
| GRANT UPDATE ON `cms`.`t_account` TO 'ut01'@'%' WITH GRANT OPTION |
+---------------------------------------------------------------------------+
2 rows in set (0.00 sec)
mysql>
但是除了使用该子句指定之外,还是通过直接授予GRANT OPTION权限来达到这个效果。比如:
D:\temp>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.7.11-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show grants for 'ut01'@'%';
+----------------------------------+
| Grants for ut01@% |
+----------------------------------+
| GRANT USAGE ON *.* TO 'ut01'@'%' |
+----------------------------------+
1 row in set (0.00 sec)
mysql> grant select on test.t_area to 'ut01'@'%';
Query OK, 0 rows affected (0.07 sec)
mysql> show grants for 'ut01'@'%';
+-----------------------------------------------+
| Grants for ut01@% |
+-----------------------------------------------+
| GRANT USAGE ON *.* TO 'ut01'@'%' |
| GRANT SELECT ON `test`.`t_area` TO 'ut01'@'%' |
+-----------------------------------------------+
2 rows in set (0.00 sec)
mysql> grant delete on cms.t_account to 'ut01'@'%';
Query OK, 0 rows affected (0.01 sec)
mysql> show grants for 'ut01'@'%';
+-------------------------------------------------+
| Grants for ut01@% |
+-------------------------------------------------+
| GRANT USAGE ON *.* TO 'ut01'@'%' |
| GRANT DELETE ON `cms`.`t_account` TO 'ut01'@'%' |
| GRANT SELECT ON `test`.`t_area` TO 'ut01'@'%' |
+-------------------------------------------------+
3 rows in set (0.00 sec)
mysql> grant grant option on test.t_area to 'ut01'@'%';
Query OK, 0 rows affected (0.06 sec)
mysql> show grants for 'ut01'@'%';
+-----------------------------------------------------------------+
| Grants for ut01@% |
+-----------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'ut01'@'%' |
| GRANT DELETE ON `cms`.`t_account` TO 'ut01'@'%' |
| GRANT SELECT ON `test`.`t_area` TO 'ut01'@'%' WITH GRANT OPTION | #在test.t_area对象上的select权限,自动具有了with grant option属性
+-----------------------------------------------------------------+
3 rows in set (0.00 sec)
mysql> grant insert on test.t_area to 'ut01'@'%';
Query OK, 0 rows affected (0.08 sec)
mysql> show grants for 'ut01'@'%';
+-------------------------------------------------------------------------+
| Grants for ut01@% |
+-------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'ut01'@'%' |
| GRANT DELETE ON `cms`.`t_account` TO 'ut01'@'%' |
| GRANT SELECT, INSERT ON `test`.`t_area` TO 'ut01'@'%' WITH GRANT OPTION | #虽然insert是后面加上的,但是同样具有了grant option属性,因为其权限范围也是test.t_area
+-------------------------------------------------------------------------+
3 rows in set (0.00 sec)
mysql>
- MySQL权限篇之GRANT OPTION
- mysql grant 权限分配
- mysql的grant权限
- mysql grant 权限分配
- mysql的grant权限
- mysql的grant权限
- mysql grant 权限分配
- mysql的grant权限
- mysql的grant权限
- mysql grant 权限操作
- mysql权限的grant命令
- mysql grant提示无权限
- mysql之grant命令
- ORACLE权限关于with admin option和with grant
- mysql数据库mysql: [ERROR] unknown option '--skip-grant-tables'
- MySQL的 Grant命令权限分配
- MySQL的 Grant命令权限分配
- Mysql 权限和grant命令详解
- javaRMI详解
- Jmeter之Bean shell使用
- 测试手机端APP时,模拟网速慢的情况
- Services 安卓服务
- 一种开源的分布式消息系统Nats
- MySQL权限篇之GRANT OPTION
- 顺时针打印矩阵
- caffe卷积层代码阅读笔记
- algrothm_判断回文数
- iOS开发数据库篇—SQLite简单介绍
- Web攻防系列教程之 Cookie注入攻防实战
- .net将word文档格式转换为pdf文件格式
- 史上最详细的Android Studio系列教程二--基本设置与运行
- Injection Plugin for Xcode成吨的提高开发效率!