zoukankan      html  css  js  c++  java
  • 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索引页 
    磨砺技术珠矶,践行数据之道,追求卓越价值

  • 相关阅读:
    Ajax实现在textbox中输入内容,动态从数据库中模糊查询显示到下拉框中
    JavaScript 多级联动浮动(下拉)菜单 (第二版)
    JavaScript在IE浏览器和Firefox浏览器中的差异总结
    IE和FF对CSS兼容问题
    XHTML的特征(规范)
    总结引入CSS样式方式中的link和import的区别
    CSS知识精化集全,每天更新一点点,自己总结。
    今天遇见了setTimeout()函数
    jquery的发展由来和深入理解(一)
    左边导航条动态增加或缩短高度以及放大缩小问题的解决方法
  • 原文地址:https://www.cnblogs.com/gaojian/p/3318387.html
Copyright © 2011-2022 走看看