zoukankan      html  css  js  c++  java
  • information_schema.column_privileges 学习

    mysql 的授权是分层次的 实例级 | 库级 | 表级 | 列级 而这些授权信息被保存在了mysql.user | mysql.db | mysql.tables_priv | mysql.column_priv 等表中

    而information_schema.column_privileges 表中的信息来自于mysql.column_priv 表

    1、information_schema.column_privileges 表中常用的列:

      1、grantee                :用户(对列就相应权限的用户)

      2、table_catalog             :表类型,好像只有一个值 def

      3、table_schema              :表所在的数据库名

      4、table_name              :表名

      5、column_anme             :列名

      6、privilege_type             :权限类型

      7、is_grantable             :是否可以把权限授予别人

    2、例子:

    查看一条对列的授权在information_schema.column_privileges 表中对应怎样的数据

    2.1 授权:

    GRANT SELECT (x) ON `tempdb`.`t` TO 'guest'@'127.0.0.1'

    2.2 查看information_schema.column_privileges 表

    select * from information_schema.column_privileges;
    
    
    +---------------------+---------------+--------------+------------+-------------+----------------+--------------+
    | GRANTEE             | TABLE_CATALOG | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | PRIVILEGE_TYPE | IS_GRANTABLE |
    +---------------------+---------------+--------------+------------+-------------+----------------+--------------+
    | 'guest'@'127.0.0.1' | def           | tempdb       | t          | x           | SELECT         | NO           |
    +---------------------+---------------+--------------+------------+-------------+----------------+--------------+
  • 相关阅读:
    7月24日学习
    7月23日学习
    7月22日学习
    7月21日学习
    【编程技巧】applicationContext.xml 里面可配置bean和数据库地址
    【编程技巧】 输入框只能输入中文
    【开发技术】Beyond Compare
    【编程技巧】Ext.QuickTips.init();
    【开发技术】常用正则表达式大全!(例如:匹配中文、匹配html)
    【编程技巧】addSubview和insertSubview的区别
  • 原文地址:https://www.cnblogs.com/JiangLe/p/5793689.html
Copyright © 2011-2022 走看看