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'

  • 相关阅读:
    自考新教材-p240_2
    自考新教材-p243_5_(1)
    自考新教材-p242_4
    自考新教材-p233
    自考新教材-p230
    Spring入门(9)-AOP初探
    MongoDB的备份与恢复
    JVM基础知识(1)-JVM内存区域与内存溢出
    Spring入门(8)-基于Java配置而不是XML
    Spring入门(7)-自动检测Bean
  • 原文地址:https://www.cnblogs.com/anxbb/p/9237968.html
Copyright © 2011-2022 走看看