• MySQL下查看和赋予权限


    磨砺技术珠矶,践行数据之道,追求卓越价值 
    回到上一级页面: PostgreSQL杂记页     回到顶级页面:PostgreSQL索引页 
    [作者 高健@博客园  luckyjackgao@gmail.com]

    查看权限表字段内容:

    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       |       |
    | Insert_priv            | enum('N','Y')                     | NO   |     | N       |       |
    | Update_priv            | enum('N','Y')                     | NO   |     | N       |       |
    | Delete_priv            | enum('N','Y')                     | NO   |     | N       |       |
    | Create_priv            | enum('N','Y')                     | NO   |     | N       |       |
    | Drop_priv              | enum('N','Y')                     | NO   |     | N       |       |
    | Reload_priv            | enum('N','Y')                     | NO   |     | N       |       |
    | Shutdown_priv          | enum('N','Y')                     | NO   |     | N       |       |
    | Process_priv           | enum('N','Y')                     | NO   |     | N       |       |
    | File_priv              | enum('N','Y')                     | NO   |     | N       |       |
    | Grant_priv             | enum('N','Y')                     | NO   |     | N       |       |
    | References_priv        | enum('N','Y')                     | NO   |     | N       |       |
    | Index_priv             | enum('N','Y')                     | NO   |     | N       |       |
    | Alter_priv             | enum('N','Y')                     | NO   |     | N       |       |
    | Show_db_priv           | enum('N','Y')                     | NO   |     | N       |       |
    | Super_priv             | enum('N','Y')                     | NO   |     | N       |       |
    | Create_tmp_table_priv  | enum('N','Y')                     | NO   |     | N       |       |
    | Lock_tables_priv       | enum('N','Y')                     | NO   |     | N       |       |
    | Execute_priv           | enum('N','Y')                     | NO   |     | N       |       |
    | Repl_slave_priv        | enum('N','Y')                     | NO   |     | N       |       |
    | Repl_client_priv       | enum('N','Y')                     | NO   |     | N       |       |
    | Create_view_priv       | enum('N','Y')                     | NO   |     | N       |       |
    | Show_view_priv         | enum('N','Y')                     | NO   |     | N       |       |
    | Create_routine_priv    | enum('N','Y')                     | NO   |     | N       |       |
    | Alter_routine_priv     | enum('N','Y')                     | NO   |     | N       |       |
    | Create_user_priv       | enum('N','Y')                     | NO   |     | N       |       |
    | Event_priv             | enum('N','Y')                     | NO   |     | N       |       |
    | Trigger_priv           | enum('N','Y')                     | NO   |     | N       |       |
    | Create_tablespace_priv | enum('N','Y')                     | NO   |     | N       |       |
    | ssl_type               | enum('','ANY','X509','SPECIFIED') | NO   |     |         |       |
    | ssl_cipher             | blob                              | NO   |     | NULL    |       |
    | x509_issuer            | blob                              | NO   |     | NULL    |       |
    | x509_subject           | blob                              | NO   |     | NULL    |       |
    | max_questions          | int(11) unsigned                  | NO   |     | 0       |       |
    | max_updates            | int(11) unsigned                  | NO   |     | 0       |       |
    | max_connections        | int(11) unsigned                  | NO   |     | 0       |       |
    | max_user_connections   | int(11) unsigned                  | NO   |     | 0       |       |
    | plugin                 | char(64)                          | YES  |     |         |       |
    | authentication_string  | text                              | YES  |     | NULL    |       |
    | password_expired       | enum('N','Y')                     | NO   |     | N       |       |
    +------------------------+-----------------------------------+------+-----+---------+-------+
    43 rows in set (0.00 sec)
    
    mysql> 

     

    赋予权限:

    mysql> GRANT SELECT, INSERT, DELETE,UPDATE ON *.* TO 'usrabc'@'%';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> FLUSH PRIVILEGES;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> 

     

    查看赋予权限的情况:

    mysql> SELECT user, host,select_priv, insert_priv, update_priv,delete_priv from mysql.user;
    +--------+------------+-------------+-------------+-------------+-------------+
    | user   | host       | select_priv | insert_priv | update_priv | delete_priv |
    +--------+------------+-------------+-------------+-------------+-------------+
    | root   | localhost  | Y           | Y           | Y           | Y           |
    | root   | server.gao | Y           | Y           | Y           | Y           |
    | root   | 127.0.0.1  | Y           | Y           | Y           | Y           |
    | root   | ::1        | Y           | Y           | Y           | Y           |
    |        | localhost  | N           | N           | N           | N           |
    |        | server.gao | N           | N           | N           | N           |
    | usrabc | %          | Y           | Y           | Y           | Y           |
    +--------+------------+-------------+-------------+-------------+-------------+
    7 rows in set (0.00 sec)
    
    mysql> 

    [作者 高健@博客园  luckyjackgao@gmail.com]
    回到上一级页面: PostgreSQL杂记页     回到顶级页面:PostgreSQL索引页 
    磨砺技术珠矶,践行数据之道,追求卓越价值

  • 相关阅读:
    Android Studio教程-创建第一个项目Hello World
    java打jar包的几种方式详解
    低学历者如何逆袭
    strlen, wcslen, _mbslen, _mbslen_l, _mbstrlen, _mbstrlen_l, setlocale(LC_CTYPE, "Japanese_Japan")(MSDN的官方示例)
    select, poll, epoll
    KVM虚拟化知识的一些笔记
    在Windows系统上以C++打印出当前活动用户的环境变量
    日志组件解析
    Angular2案例rebirth开源
    视图
  • 原文地址:https://www.cnblogs.com/gaojian/p/3318387.html
Copyright © 2020-2023  润新知