在 MySQL 中查看授權 (View grants in MySQL)


問題描述

在 MySQL 中查看授權 (View grants in MySQL)

如何在 MySQL 中查看給定用戶的授權(訪問權限)?


參考解法

方法 1:

An alternative method for recent versions of MySQL is:

select * from information_schema.user_privileges where grantee like "'user'%";

The possible advantage with this format is the increased flexibility to check "user's" grants from any host (assuming consistent user names) or to check for specific privileges with additional conditions (eg, privilege_type = 'delete').

This version is probably better suited to use within a script while the "show grants" syntax is better for interactive sessions (more "human readable").

方法 2:

mysql> show grants for 'user'@'host'

方法 3:

You could try this:

SELECT GRANTEE, PRIVILEGE_TYPE FROM information_schema.user_privileges;
SELECT User,Host,Db FROM mysql.db;

方法 4:

You might want to check out mk‑show‑grants from Maatkit, which will output the current set of grants for all users in a canonical form, making version control or replication more straightforward.

方法 5:

If you're already running a web server with PHP then phpMyAdmin is a fairly friendly administrative tool.

(by alanc10nigelkottalanc10nAnitaJon TopperKevin ORourke)

參考文件

  1. View grants in MySQL (CC BY‑SA 2.5/3.0/4.0)

#MySQL






相關問題

MySQL WHERE 時間戳 >= SUBDATE(MAX(timestamp), INTERVAL 5 DAY) (MySQL WHERE timestamp >= SUBDATE(MAX(timestamp), INTERVAL 5 DAY))

無法連接 - 數據庫或編碼錯誤 (Could Not Connect - Database or Coding Error)

在 MySQL 中查看授權 (View grants in MySQL)

修改列與更改列 (Modify column Vs change column)

SQL 查詢沒有返回任何值 (SQL query did not return any values)

IFNULL trong vấn đề tốc độ mysql (IFNULL in mysql speed issue)

Tối ưu hóa truy vấn MySQL PHP - Phản hồi (MySQL PHP Query Optimization - Feedbacks)

我將如何從我的數據庫中顯示用戶個人資料圖片? (How would I go about displaying user profile pictures from my database?)

自聯接以比較同一張表中的季度數據? (Self join to compare quarterly data from same table?)

設置默認數據庫連接 Mysql Workbench 5.2 (Set Default Database connection Mysql Workbench 5.2)

在 Mac 上將 PHP/MySQL/HTML 生成的報告轉換為 PDF 格式 (Convert reports generated in PHP/MySQL/HTML to PDF format on a Mac)

MYSQL查詢神奇地抓取數值 (MYSQL query magically grabs numeric value)







留言討論