mysql grant proxy on_MySQL 5.7权限的介绍
MySQL支持的權(quán)限如下:
ALL或ALL PRIVILEGES 代表指定權(quán)限等級(jí)的所有權(quán)限。
ALTER 允許使用ALTER TABLE來改變表的結(jié)構(gòu),ALTER TABLE同時(shí)也需要CREATE和INSERT權(quán)限。重命名一個(gè)表需要對(duì)舊表具有ALTER和DROP權(quán)限,對(duì)新版具有CREATE和INSERT權(quán)限。
ALTER ROUTINE 允許改變和刪除存儲(chǔ)過程和函數(shù)
CREATE 允許創(chuàng)建新的數(shù)據(jù)庫和表
CREATE ROUTINE 允許創(chuàng)建創(chuàng)建存儲(chǔ)過程和包
CREATE TABLESPACE 允許創(chuàng)建、更改和刪除表空間和日志文件組
CREATE TEMPORARY TABLES 允許創(chuàng)建臨時(shí)表
CREATE USER 允許更改、創(chuàng)建、刪除、重命名用戶和收回所有權(quán)限
CREATE VIEW 允許創(chuàng)建視圖
DELETE 允許從數(shù)據(jù)庫的表中刪除行
DROP 允許刪除數(shù)據(jù)庫、表和視圖
EVENT 允許在事件調(diào)度里面創(chuàng)建、更改、刪除和查看事件
EXECUETE 允許執(zhí)行存儲(chǔ)過程和包
FILE 允許在服務(wù)器的主機(jī)上通過LOAD DATA INFILE、SELECT ... INTO OUTFILE和LOAD_FILE()函數(shù)讀寫文件
GRANT OPTION 允許向其他用戶授予或移除權(quán)限
INDEX 允許創(chuàng)建和刪除索引
INSERT 允許向數(shù)據(jù)庫的表中插入行
LOCK TABLE 允許執(zhí)行LOCK TABLES語句來鎖定表
PROCESS 允許顯示在服務(wù)器上執(zhí)行的線程信息,即被會(huì)話所執(zhí)行的語句信息。這個(gè)權(quán)限允許你執(zhí)行SHOW PROCESSLIST和mysqladmin?processlist命令來查看線程,同時(shí)這個(gè)權(quán)限也允許你執(zhí)行SHOW ENGINE命令
PROXY 允許用戶冒充成為另外一個(gè)用戶
REFERENCES 允許創(chuàng)建外鍵
RELOAD 允許使用FLUSH語句
REPLICATION CLIENT 允許執(zhí)行SHOW MASTER STATUS,SHOW SLAVE STATUS和SHOW BINARY LOGS命令
REPLICATION SLAVE 允許SLAVE服務(wù)器連接到當(dāng)前服務(wù)器來作為他們的主服務(wù)器
SELECT 允許從數(shù)據(jù)庫中查詢表
SHOW DATABASES 允許賬戶執(zhí)行SHOW DATABASE語句來查看數(shù)據(jù)庫。沒有這個(gè)權(quán)限的賬戶只能看到他們具有權(quán)限的數(shù)據(jù)庫。
SHOW VIEW 允許執(zhí)行SHOW CREATE VIEW語句
SHUTDOWN 允許執(zhí)行SHUTDOWN語句和mysqladmin shutdown已經(jīng)mysql_shutdown() C API函數(shù)
SUPER 允許用戶執(zhí)行CHANGE MASTER TO,KILL或mysqladmin kill命令來殺掉其他用戶的線程,允許執(zhí)行PURGE BINARY LOGS命令,通過SET?GLOBAL來設(shè)置系統(tǒng)參數(shù),執(zhí)行mysqladmin debug命令,開啟和關(guān)閉日志,即使read_only參數(shù)開啟也可以執(zhí)行update語句,打開和關(guān)閉從服務(wù)器上面的復(fù)制,允許在連接數(shù)達(dá)到max_connections的情況下連接到服務(wù)器。
TRIGGER 允許操作觸發(fā)器
UPDATE 允許更新數(shù)據(jù)庫中的表
USAGE 代表沒有任何權(quán)限
授予全局權(quán)限:
*.*代表所有數(shù)據(jù)庫的權(quán)限
mysql> grant all on *.* to 'test'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> grant select, insert on *.* to 'test'@'%';
Query OK, 0 rows affected (0.00 sec)
授予指定數(shù)據(jù)庫的權(quán)限:
mysql> grant all on test.* to 'test'@'localhost';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> grant select, insert on *.* to 'test'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> grant select, insert on test.* to 'test'@'%';
Query OK, 0 rows affected (0.00 sec)
授予指定表的權(quán)限:
mysql> grant all on test.orders to 'jeffrey'@'localhost';
Query OK, 0 rows affected (0.13 sec)
mysql> grant select, insert on test.orders to 'jeffrey'@'localhost';
Query OK, 0 rows affected (0.07 sec)
授予指定字段的權(quán)限:
mysql> desc test.orders_1;
+---------------+-------------+------+-----+---------+-------+
| Field ? ? ? ? | Type ? ? ? ?| Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+-------+
| order_date ? ?| date ? ? ? ?| YES ?| ? ? | NULL ? ?| ? ? ? |
| order_id ? ? ?| int(11) ? ? | YES ?| ? ? | NULL ? ?| ? ? ? |
| customer_name | varchar(15) | YES ?| ? ? | NULL ? ?| ? ? ? |
| product_id ? ?| int(11) ? ? | YES ?| ? ? | NULL ? ?| ? ? ? |
+---------------+-------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
mysql> grant select(order_date), insert(order_id,customer_name) on test.orders_1 to 'jeffrey'@'localhost';
Query OK, 0 rows affected (0.01 sec)
[root@T400-kelong ~]# mysql -ujeffrey -p
Enter password:
Welcome to the MySQL monitor. ?Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.10-log MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from orders_1;
ERROR 1142 (42000): SELECT command denied to user 'jeffrey'@'localhost' for table 'orders_1'
mysql> select order_date from orders_1;
+------------+
| order_date |
+------------+
| 2016-03-26 |
+------------+
1 row in set (0.00 sec)
授予存儲(chǔ)過程的權(quán)限:
mysql> grant create routine on test.* to 'jeffrey'@'localhost';
Query OK, 0 rows affected (0.08 sec)
mysql> grant execute on procedure test.myproc to 'jeffrey'@'localhost';
Query OK, 0 rows affected (0.04 sec)
授予代理用戶權(quán)限:
PROX權(quán)限可以使一個(gè)用戶成為另外一個(gè)用戶的代理
mysql> grant proxy on 'jeffrey'@'localhost' to 'test'@'%';
Query OK, 0 rows affected (0.09 sec)
總結(jié)
以上是生活随笔為你收集整理的mysql grant proxy on_MySQL 5.7权限的介绍的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 魅族安卓5.1.1怎么升级到6.0(魅族
- 下一篇: mysql排插问题_MySQL一次数据插