• mysql打印用户权限的小技巧


    mysql5.5 5.6

    SHOW GRANTS FOR

    mysql> SELECT DISTINCT CONCAT('SHOW GRANTS FOR ''',user,'''@''',host,''';') AS query FROM mysql.user;
    +------------------------------------------------------+
    | CONCAT('SHOW GRANTS FOR ''',user,'''@''',host,''';') |
    +------------------------------------------------------+
    | SHOW GRANTS FOR 'root'@'localhost';                  |
    +------------------------------------------------------+
    1 rows in set (0.01 sec)
    
    mysql> SHOW GRANTS FOR 'root'@'localhost';
    +----------------------------------------------------------------------------------------------------------------------------------------+
    | Grants for root@localhost                                                                                                              |
    +----------------------------------------------------------------------------------------------------------------------------------------+
    | GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*79065082DC40BD289FD24E8D80A7DAEFC8D15F94' WITH GRANT OPTION |
    | GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION                                                                           |
    +----------------------------------------------------------------------------------------------------------------------------------------+
    2 rows in set (0.00 sec)
    

    mysql5.7

    SHOW CREATE USER

    mysql> SELECT CONCAT('SHOW CREATE USER   ''', user, '''@''', host, ''';' ) AS query FROM mysql.user;
    +-------------------------------------------------+
    | query                                           |
    +-------------------------------------------------+
    | SHOW CREATE USER   'root'@'172.17.0.1';         |
    | SHOW CREATE USER   'mysql.session'@'localhost'; |
    | SHOW CREATE USER   'mysql.sys'@'localhost';     |
    | SHOW CREATE USER   'root'@'localhost';          |
    +-------------------------------------------------+
    4 rows in set (0.03 sec)
    
    mysql>  SHOW CREATE USER   'root'@'172.17.0.1'; 
    +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | CREATE USER for root@172.17.0.1                                                                                                                                            |
    +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | CREATE USER 'root'@'172.17.0.1' IDENTIFIED WITH 'mysql_native_password' AS '*51AC5E121D319E23ABA95E9131ED8C06D2B9DBE8' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK |
    +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)
    
  • 相关阅读:
    Python环境搭建后,多种方式的使用进行程序的执行。
    Visual Studio 2017进行Python开发环境的搭建,使用VS2017进行python代码的编写。
    Linux Ubuntu运行线程程序出现undefined reference to ‘pthread_create’和undefined reference to ‘pthread_join’错误。
    计算机二级-C语言-程序填空题-190107记录
    2018/03/08 每日一学PHP 之 常量defind 和 const区别
    H5手机页面剖析
    jQuery(三)
    jQuery(二)
    jQuery(一)
    JS构造函数(便于理解,简易)
  • 原文地址:https://www.cnblogs.com/wshenjin/p/10943696.html
Copyright © 2020-2023  润新知