博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
查看MYSQL数据库中所有用户及拥有权限
阅读量:5818 次
发布时间:2019-06-18

本文共 3970 字,大约阅读时间需要 13 分钟。

转自 <;

查看MYSQL数据库中所有用户

mysql> SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;+---------------------------------------+| query                                 |+---------------------------------------+| User: 'cactiuser'@'%';                | | User: 'common_user'@'%';              | | User: 'dba'@'%';                      | | User: 'root'@'%';                     | | User: 'slave'@'%';                    | | User: 'wtgame'@'%';                   | | User: 'root'@'127.0.0.1';             | | User: 'webman'@'127.0.0.1';           | | User: 'root'@'192.168.166.200';       | | User: 'cactiuser'@'192.168.166.202';  | | User: 'root'@'192.168.166.202';       | | User: ''@'localhost';                 | | User: 'cacti'@'localhost';            | | User: 'cactiuser'@'localhost';        | | User: 'dba'@'localhost';              | | User: 'extmail'@'localhost';          | | User: 'javauser'@'localhost';         | | User: 'root'@'localhost';             | | User: 'webman'@'localhost';           | | User: ''@'localhost.localdomain';     | | User: 'root'@'localhost.localdomain'; | +---------------------------------------+21 rows in set (0.01 sec)

查看数据库中具体某个用户的权限

mysql> show grants for 'cactiuser'@'%';    +-------------------------------------------------------------------------------------------------------------------+| Grants for cactiuser@%                                                                                            |+-------------------------------------------------------------------------------------------------------------------+| GRANT PROCESS, SUPER ON *.* TO 'cactiuser'@'%' IDENTIFIED BY PASSWORD '*DAFF917B80E3314B1ABECBA9DF8785AFD342CE89' | | GRANT ALL PRIVILEGES ON `cacti`.* TO 'cactiuser'@'%'                                                              | +-------------------------------------------------------------------------------------------------------------------+2 rows in set (0.00 sec)
mysql> select * from mysql.user where user='cactiuser' \G   *************************** 1. row ***************************                 Host: %                 User: cactiuser             Password: *DAFF917B80E3314B1ABECBA9DF8785AFD342CE89          Select_priv: N          Insert_priv: N          Update_priv: N          Delete_priv: N          Create_priv: N            Drop_priv: N          Reload_priv: N        Shutdown_priv: N         Process_priv: Y            File_priv: N           Grant_priv: N      References_priv: N           Index_priv: N           Alter_priv: N         Show_db_priv: N           Super_priv: YCreate_tmp_table_priv: N     Lock_tables_priv: N         Execute_priv: N      Repl_slave_priv: N     Repl_client_priv: N     Create_view_priv: N       Show_view_priv: N  Create_routine_priv: N   Alter_routine_priv: N     Create_user_priv: N           Event_priv: N         Trigger_priv: N             ssl_type:            ssl_cipher:           x509_issuer:          x509_subject:         max_questions: 0          max_updates: 0      max_connections: 0 max_user_connections: 0

查看user表结构 需要具体的项可结合表结构来查询

mysql> desc mysql.user;+-----------------------+-----------------------------------+------+-----+---------+-------+| Field                 | Type                              | Null | Key | Default | Extra |+-----------------------+-----------------------------------+------+-----+---------+-------+| Host                  | char(60)                          | NO   | PRI |         |       | | User                  | char(16)                          | NO   | PRI |         |       | | Password              | char(41)                          | NO   |     |         |       | | Select_priv           | enum('N','Y')                     | NO   |     | N       |       | ************************************+-----------------------+-----------------------------------+------+-----+---------+-------+39 rows in set (0.00 sec)

转载于:https://blog.51cto.com/13770206/2393561

你可能感兴趣的文章
jdbc,链接调用数据库的方法——例题
查看>>
C# 基础:ref和out的区别
查看>>
Python 脚本学习笔记(四) 定制业务质量报表
查看>>
CentOS\Scientific Linux\RHEL网络配置
查看>>
bzoj 3993: [SDOI2015]星际战争
查看>>
linux学习-开机权限修改、修改主机名、shell介绍
查看>>
Error: Connection activation failed: Device not managed by NetworkManager解决方法
查看>>
bzoj 1497: [NOI2006]最大获利
查看>>
bzoj 1818: [Cqoi2010]内部白点
查看>>
PHP Security Guide
查看>>
我的友情链接
查看>>
Windows下bat脚本判断端口是否可用
查看>>
IPSEC ×××连接建立(IKE)详解
查看>>
Cisco.PIX防火墙配置
查看>>
光猫手机自动激活系统
查看>>
jzoj5989. 【北大2019冬令营模拟2019.1.6】Forest (set)
查看>>
LintCode 12.带最小值操作的栈(两种方法实现)
查看>>
java线程池ThreadPoolExecutor
查看>>
python程序daemon化
查看>>
node.js之调试器
查看>>