zoukankan      html  css  js  c++  java
  • MySQL 授权,回收权限,查看权限

    show GRANTS for root@localhost;
    flush privileges;
    SHOW PROCESSLIST;

    #全局授权,回收权限
    GRANT ALL ON *.* TO 'testzzq'@'localhost';
    REVOKE ALL ON *.* FROM 'testzzq'@'localhost';
    flush privileges;

    #数据库级别,授权,回收权限
    GRANT ALL PRIVILEGES ON cs TO 'testzzq'@'localhost';
    REVOKE ALL PRIVILEGES ON cs FROM 'testzzq'@'localhost';
    flush privileges;

    #数据库表级别,授权,回收权限
    GRANT ALL PRIVILEGES ON cs.apply_reduction TO 'testzzq'@'localhost' WITH MAX_QUERIES_PER_HOUR 2;
    GRANT SELECT(id,username),UPDATE(id,username) ON cs.user TO 'testzzq'@'localhost';
    REVOKE SELECT,UPDATE ON cs.user from 'testzzq'@'localhost';
    REVOKE ALL PRIVILEGES ON cs.apply_reduction FROM 'testzzq'@'localhost';
    flush privileges;


    授权公式:
    GRANT
    priv_type [(column_list)]
    [, priv_type [(column_list)]] ...
    ON [object_type] priv_level
    TO user [auth_option] [, user [auth_option]] ...
    [REQUIRE {NONE | tls_option [[AND] tls_option] ...}]
    [WITH {GRANT OPTION | resource_option} ...]

    resource_option: {
    | MAX_QUERIES_PER_HOUR count
    | MAX_UPDATES_PER_HOUR count
    | MAX_CONNECTIONS_PER_HOUR count
    | MAX_USER_CONNECTIONS count
    }

    The number of queries an account can issue per hour
    一个账号每小时可以发起查询操作的个数
    The number of updates an account can issue per hour
    一个账号每小时可以发起更新操作的个数
    The number of times an account can connect to the server per hour
    一个账号每小时可以连接服务器的次数
    The number of simultaneous connections to the server by an account
    一个账号同时可以连接服务器的个数,


    #查看权限

    show GRANTS for 'testzzq'@'localhost'

  • 相关阅读:
    利用WebClient实现自动添写、提交表单
    动态.net代码生成器遇到的问题
    unicode
    使用using清理非托管资源
    C#中解决插入数据库的某个字段类型为datetime 为空
    JQuery中根据属性或属性值获得元素
    Access 的top和order by 的问题
    JavaScript escape() 函数
    Asp.net嵌套
    合并程序集时出错的问题ILMerge.Merge.ERROR...
  • 原文地址:https://www.cnblogs.com/anxbb/p/9237968.html
Copyright © 2011-2022 走看看