MySQL使用者許可權詳解

2021-09-22 19:47:47 字數 1258 閱讀 9771

如果需要檢視mysql使用者許可權,應該如何實現呢?下面就為您介紹檢視mysql使用者許可權的方法,並對授予mysql使用者許可權的語句進行介紹,供您參考。

檢視mysql使用者許可權:

show grants for 你的使用者

比如:show grants for root@'localhost';

grant 用法

grant usage on *.* to 'discuz'@'localhost' identified by password '*c242ddd213be9c6f8da28d49245bf69fc79a86eb';

grant all privileges on `discuz`.* to 'discuz'@'localhost';

我先按我的理解解釋一下上面兩句的意思

建立乙個只可以在本地登陸的 不能操作的用使用者名稱 discuz 密碼為 ***** 已經加密了的

然後第二句的意思是 ,給這個discuz使用者操作discuz資料庫的所有許可權

使用grant

grant命令用來建立新使用者,指定使用者口令並增加使用者許可權。其格式如下:

mysql> grant on

-> to [identified by ""]

-> [with grant option];

正如你看到的,在這個命令中有許多待填的內容。讓我們逐一地對它們進行介紹,並最終給出一些例子以讓你對它們的協同工作有乙個了解。

是乙個用逗號分隔的你想要賦予的mysql使用者許可權的列表。你可以指定的許可權可以分為三種型別:

資料庫/資料表/資料列許可權:

alter: 修改已存在的資料表(例如增加/刪除列)和索引。

create: 建立新的資料庫或資料表。

delete: 刪除表的記錄。

drop: 刪除資料表或資料庫。

index: 建立或刪除索引。

insert: 增加表的記錄。

select: 顯示/搜尋表的記錄。

update: 修改表中已存在的記錄。

全域性管理mysql使用者許可權:

file: 在mysql伺服器上讀寫檔案。

process: 顯示或殺死屬於其它使用者的服務執行緒。

reload: 過載訪問控制表,重新整理日誌等。

shutdown: 關閉mysql服務。

特別的許可權:

all: 允許做任何事(和root一樣)。

usage: 只允許登入--其它什麼也不允許做。

posted on 2018-05-17 01:13收藏

mysql使用者 MySQL使用者許可權管理詳解

使用者許可權管理主要有以下作用 1.可以限制使用者訪問哪些庫 哪些表 2.可以限制使用者對哪些表執行select create delete delete alter等操作 3.可以限制使用者登入的ip或網域名稱 4.可以限制使用者自己的許可權是否可以授權給別的使用者 一 使用者授權 mysql g...

mysql配置使用者許可權 mysql使用者許可權配置

mysql使用者許可權配置 有什麼不對的地方請各位大神多多指教!1,檢視使用者表 mysql select user,password,host from mysql.user user 使用者名稱 password 密碼 加密 host 連線ip 2,開放遠端連線 vim etc mysql ma...

mysql使用者許可權時間 Mysql使用者許可權管理

1.檢視mysql使用者 select user,host,authentication string from mysql.user user host authentication string root localhost root b7d0cf7b6e2f root 127.0.0.1 ro...