mysql 权限管理 针对表的字段 级别 授权 columns_priv表
针对Mike账号 db1库下面的t1表的 id,name字段授予select权限,age字段授予update权限
授权格式 select(要授权的字段,要授权的字段) 用户括号 括起来 、update()
mysql> grant select(id,name),update(age) on db1.t1 to 'mike'@'localhost';
Query OK, 0 rows affected (0.11 sec)
授权的记录
mysql> select * from mysql.columns_priv;
+-----------+-----+------+------------+-------------+---------------------+-------------+
| Host | Db | User | Table_name | Column_name | Timestamp | Column_priv |
+-----------+-----+------+------------+-------------+---------------------+-------------+
| localhost | db1 | mike | t1 | id | 0000-00-00 00:00:00 | Select |
| localhost | db1 | mike | t1 | name | 0000-00-00 00:00:00 | Select |
| localhost | db1 | mike | t1 | age | 0000-00-00 00:00:00 | Update |
+-----------+-----+------+------------+-------------+---------------------+-------------+
3 rows in set (0.00 sec)
验证
mysql> exit
Bye [root@mysql ~]# mysql -umike -p123
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.6.36 Source distribution Copyright (c) 2000, 2017, 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> use db1;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
mysql> show tables;
+---------------+
| Tables_in_db1 |
+---------------+
| t1 |
+---------------+
1 row in set (0.00 sec) mysql> select * from t1;
ERROR 1142 (42000): SELECT command denied to user 'mike'@'localhost' for table 't1' mysql> select id,name from t1;
+------+------+
| id | name |
+------+------+
| 1 | mike |
| 2 | alex |
| 3 | NULL |
| 4 | NULL |
+------+------+
4 rows in set (0.00 sec)
*代表所有字段
只能查看t1表中的 id,name字段
不能查age字段 但可以用update age字段
mysql> select age from t1;
ERROR 1143 (42000): SELECT command denied to user 'mike'@'localhost' for column 'age' in table 't1'
mysql 权限管理 针对表的字段 级别 授权 columns_priv表的更多相关文章
- mysql 权限管理 目录
mysql 权限管理介绍 mysql 权限管理 记录 mysql 权限管理 grant 命令 mysql 权限管理 revoke 回收权限 命令 mysql 权限管理 针对库 授权 db.* mysq ...
- mysql 权限管理介绍
mysql权限管理 就是对控制用户对库.对表的权限.对表中字段权限 权限管理分步 1.创建账号 创建账号有本地账号和远程账号 本地账号 本地账号只能在mysql服务端机器做操作 '; # mysql ...
- MySQL权限管理实战
前言: 不清楚各位同学对数据库用户权限管理是否了解,作为一名 DBA ,用户权限管理是绕不开的一项工作内容.特别是生产库,数据库用户权限更应该规范管理.本篇文章将会介绍下 MySQL 用户权限管理相关 ...
- mysql权限管理命令示例
mysql权限管理命令示例 grant all privileges on *.* to *.* identified by 'hwalk1'; flush privileges; insert in ...
- MySQL权限管理、配置文件(三)
一.MySQL权限管理 GRANT 权限 ON 授权范围 TO '用户名'@'允许的ip(所有%)' IDENTIFIED BY '用户密码'; 权限:参加下表,一般常用的是CREATE.DELETE ...
- mysql权限管理
经常遇到有网友在QQ群或者论坛上问关于mysql权限的问题,今天抽空总结一下关于这几年使用MYSQL的时候关于MYSQL数据库的权限管理的经验,也希望能对使用mysql的网友有所帮助! 一.MYSQL ...
- mysql 权限管理
参考: http://www.cnblogs.com/Richardzhu/p/3318595.html 一.MySQL权限简介 关于mysql的权限简单的理解就是mysql允许你做你全力以内 ...
- Mysql——权限管理
安装Mysql时会自动安装一个名为mysql的数据库.这个数据库下面存储的是权限表. mysql> show databases; +--------------------+ | Databa ...
- 数据库——MySQL——权限管理
关于MySQL的权限管理,可以理解为是MySQL运行你做的事情.比如MySQL允许你执行select操作那么你就不能用update操作.如果你让你在某台机器上连接MySQL,那么你就不能在这个机器以外 ...
随机推荐
- Linux学习(二)
Linux进程管理 每个 Linux 命令都与系统中的程序对应,输入命令,Linux 就会创建一个新的进程.例如使用 ls 命令遍历目录中的文件时,就创建了一个进程.简而言之,进程就是程序的实例. 创 ...
- Delphi应用程序的调试(四)The Debug Inspector
调试检查器(The Debug Inspector) Debug Inspector使用户能查看诸如类和记录的数据对象,也可以用它来查看整数.字符数组等简单数据类型,但这类简单数据类型最好是用Watc ...
- 怎样用SQL语句查看查询的性能指标
一.SET STATISTICS IO (有关TSQL语句查询所产生的磁盘活动量) 扫描计数:在查询中涉及到的表被访问的次数: 逻辑读取:从数据缓冲中读取的数据页数: 物理读取:从物理磁盘中往缓冲读 ...
- jquery 元素选择器集合
一.基本选择器 1. id选择器(指定id元素) 将id="one"的元素背景色设置为黑色.(id选择器返单个元素) $(document).ready(function () { ...
- Kotlin 资料
https://kotlinlang.org/docs/reference/ 官方 https://github.com/JetBrains/kotlin/releases Kotlin SDK ...
- Robotium源码解读-native控件/webview元素的获取和操作
目前比较有名的Uitest框架有Uiautomator/Robotium/Appium,由于一直对webview元素的获取和操作比较好奇,另外Robotium代码量也不是很大,因此打算学习一下. 一. ...
- thinkphp 构建子查询
thinkphp构建子查询sql语句写法 从3.0版本开始新增了子查询支持,有两种使用方式: 1.使用select方法 当select方法的参数为false的时候,表示不进行查询只是 ...
- CF 455A Boredom
A. Boredom time limit per test 1 second memory limit per test 256 megabytes input standard input out ...
- 一辈子只有1次成为BAT的机会,你如何把握?
本文转自:http://www.fmi.com.cn/index.php?m=content&c=index&a=show&catid=9&id=614308 感谢作者 ...
- Centos 安装 MySQL-python
更新yum yum update yum install mysql-devel yum install gcc yum install python-devel pip install MySQL- ...