Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10168620
  • 博文数量: 1669
  • 博客积分: 16831
  • 博客等级: 上将
  • 技术积分: 12594
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-25 07:23
个人简介

柔中带刚,刚中带柔,淫荡中富含柔和,刚猛中荡漾风骚,无坚不摧,无孔不入!

文章分类

全部博文(1669)

文章存档

2023年(4)

2022年(1)

2021年(10)

2020年(24)

2019年(4)

2018年(19)

2017年(66)

2016年(60)

2015年(49)

2014年(201)

2013年(221)

2012年(638)

2011年(372)

分类: Mysql/postgreSQL

2014-03-04 17:24:41

分类: LINUX


查看MYSQL数据库中所有用户
mysql> SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
+---------------------------------------+
| query                                 |
+---------------------------------------+
| User: 
;                | 
| User: 
;              | 
| User: 
;                      | 
| User: 
;                     | 
| User: 
;                    | 
| User: 
;                   | 
| User: 
;             | 
| User: 
;           | 
| User: 
;       | 
| User: 
;  | 
| User: 
;       | 
| User: 
;                 | 
| User: 
;            | 
| User: 
;        | 
| User: 
;              | 
| User: 
;          | 
| User: 
;         | 
| User: 
;             | 
| User: 
;           | 
| User: 
;     | 
| User: 
; | 
+---------------------------------------+
21 rows in set (0.01 sec)
 
查看数据库中具体某个用户的权限
mysql> show grants for 
;    
+-------------------------------------------------------------------------------------------------------------------+
| Grants for 
                                                                                            |
+-------------------------------------------------------------------------------------------------------------------+
| GRANT PROCESS, SUPER ON *.* TO 
 IDENTIFIED BY PASSWORD '*DAFF917B80E3314B1ABECBA9DF8785AFD342CE89' | 
| GRANT ALL PRIVILEGES ON `cacti`.* TO 
                                                              | 
+-------------------------------------------------------------------------------------------------------------------+
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)
阅读(1335) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~