查看MYSQL数据库中所有用户及拥有权限
2016-01-28 18:38
555 查看
查看MYSQL数据库中所有用户及拥有权限
原文地址:http://blog.chinaunix.net/uid-21505614-id-302263.html
查看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: Y
Create_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)
原文地址:http://blog.chinaunix.net/uid-21505614-id-302263.html
查看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: Y
Create_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)
相关文章推荐
- mysql中like模糊查询优化
- LNMP环境搭建-mysql
- MySql 小记
- MySQL 数据库优化
- mysql重复索引、冗余索引、未使用索引的定义和查找
- MySQL常见的错误代码及代码说明
- mysql授予权限小结
- 安装mysql教程(出现Install/Remove of the Service Denied)
- mysql 变量使用,存储过程
- MySql――性能优化建议
- MySQL(my.ini)配置文件详解
- MySQL Proxy
- MySql Replication
- Ubuntu下面安装mysql
- mysql : The user specified as a definer ('root'@'%') does not exist
- mysql自增长为什么会每次加2的原因
- Mysql日志详解
- MySQL外键 Cannot add or update a child row错误的实例解释
- spark scala mysql 语法
- mysql使用索引扫描来做排序