日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql grant proxy on_MySQL 5.7权限的介绍

發(fā)布時間:2023/12/2 数据库 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql grant proxy on_MySQL 5.7权限的介绍 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

MySQL支持的權(quán)限如下:

ALL或ALL PRIVILEGES 代表指定權(quán)限等級的所有權(quán)限。

ALTER 允許使用ALTER TABLE來改變表的結(jié)構(gòu),ALTER TABLE同時也需要CREATE和INSERT權(quán)限。重命名一個表需要對舊表具有ALTER和DROP權(quán)限,對新版具有CREATE和INSERT權(quán)限。

ALTER ROUTINE 允許改變和刪除存儲過程和函數(shù)

CREATE 允許創(chuàng)建新的數(shù)據(jù)庫和表

CREATE ROUTINE 允許創(chuàng)建創(chuàng)建存儲過程和包

CREATE TABLESPACE 允許創(chuàng)建、更改和刪除表空間和日志文件組

CREATE TEMPORARY TABLES 允許創(chuàng)建臨時表

CREATE USER 允許更改、創(chuàng)建、刪除、重命名用戶和收回所有權(quán)限

CREATE VIEW 允許創(chuàng)建視圖

DELETE 允許從數(shù)據(jù)庫的表中刪除行

DROP 允許刪除數(shù)據(jù)庫、表和視圖

EVENT 允許在事件調(diào)度里面創(chuàng)建、更改、刪除和查看事件

EXECUETE 允許執(zhí)行存儲過程和包

FILE 允許在服務(wù)器的主機上通過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í)行的線程信息,即被會話所執(zhí)行的語句信息。這個權(quán)限允許你執(zhí)行SHOW PROCESSLIST和mysqladmin?processlist命令來查看線程,同時這個權(quán)限也允許你執(zhí)行SHOW ENGINE命令

PROXY 允許用戶冒充成為另外一個用戶

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ù)庫。沒有這個權(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ù)達到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)

授予存儲過程的權(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)限可以使一個用戶成為另外一個用戶的代理

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)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。