mysql檢視使用者物件 Mysql許可權管理

2021-10-18 13:36:38 字數 1431 閱讀 1511

一、mysql使用者許可權

mysql許可權分為3類:

1.mysql服務管理許可權:用於管理mysql伺服器的操作。這些許可權是全域性性的,授權範圍不能是特定的資料庫或物件。只能使用*.*方式授予,不能使用db.*或db.tb方式授權;

2.資料庫級別許可權:授權範圍可以是所有資料庫,也可以是單個資料庫下面的所有物件。可以使用*.*方式授予全部資料庫,也可以使用db.*授予單個資料庫;

3.物件級別許可權:授權範圍可以是所有資料庫,也可以是單個資料庫下面的所有物件,也可以是特定的物件。可以使用*.*方式授予全部資料庫,也可以使用db.*授予單個資料庫,還可以使用db.tb授予單個物件

二、建立並授權、檢視、刪除賬戶

(1) 使用create user語句建立賬戶,建立賬戶的sql語句如下:

create user ``@`` identified by '';

建立賬戶三種情況

本地訪問mysql的使用者user1,密碼是123456

create user `user1`@`localhost` identified by '123456';

使192.168.210.*網段訪問mysql的使用者user2

create user `user2`@`192.168.210.*` identified by '123456';

任何使用者訪問mysql的使用者user3

create user `user3`@`%` identified by '123456';

(2) 刪除賬戶

drop user `user1`@`localhost`;

(3)檢視mysql裡面有哪些賬戶

mysql> select user,host from mysql.user;

| user             | host         |

| user1            | localhost

| root             | %            |

| user3            | %            |

| user2            | 192.168.210.* |

| mysql.infoschema | localhost    |

| mysql.session    | localhost    |

| mysql.sys        | localhost    |

(4) 檢視某個使用者的許可權資訊

MySQL檢視使用者

環境 centos 6.5 64bit mysql server版本 5.7.21 一 檢視所有使用者 在mysql中有乙個內建名為mysql的資料庫,這個資料庫中儲存的是mysql的一些資料,比如使用者 許可權資訊 儲存過程等。所以我們可以通過如下查詢語句來檢視所有使用者。mysql select...

mysql 檢視使用者許可權

show grants for root localhost grant usage on to discuz localhost identified by password c242ddd213be9c6f8da28d49245bf69fc79a86eb grant all privileges...

mysql檢視使用者許可權

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