2010-11-18 35 views
8

我可以插入,更新,刪除等到我的MySQL數據庫中的表,但我無法顯示錶狀態。有誰知道需要哪些特權才能做到這一點?對MySQL中的「SHOW TABLE STATUS」的適當權限

這是我的錯誤信息:

Access denied for user 'admin459'@'localhost' to database 'sample' 
+0

問得好提到!該手冊完全靜音。 http://dev.mysql.com/doc/refman/5.1/en/grant.html#grant-table-privileges – 2010-11-18 17:05:20

+0

http://dev.mysql.com/doc/refman/5.0/en/show.html - 最後部分加上用戶評論間接參考SELECT = SHOW,但是,如果用戶能夠更新/刪除/插入,不知道爲什麼被阻止選擇 – ajreal 2010-11-18 20:11:35

+0

這可能是你的問題:http://stackoverflow.com/questions/ 6527599/MySQL的 - 忘記 - 誰 - 是 - 登錄命令被拒絕到用戶 – 2013-06-12 21:17:03

回答

1

最小(僅限選擇)特權是我需要的所有表格狀態。什麼版本的MySQL?

grant select on test_dev.districts to [email protected] identified by 'monkey'; 

則:

mysql -pmonkey -u td3 TAMS_development -e 'show table status;' 

作品。

這對你有什麼回報?

show grants for [email protected]; 
0

似乎很奇怪......即使我的MySQL用戶用最少的priveledges可以做SHOW TABLE STATUS是在各自的數據庫。

你能舉一個你正在嘗試的確切語法的例子嗎?

例如SHOW TABLE STATUS IN sample LIKE 'users'

0

也許嘗試另一種方式來查看關於特定表中的信息,
尤其是列註釋(旁邊期間SHOW TABLE STATUS「拒絕訪問」):

訪問的INFORMATION_SCHEMA數據庫直接(如果你有 SELECT權限)。

有關表本身(通常爲一個三元組)信息:

SELECT 
    * 
FROM 
    information_schema.tables 
WHERE 
     table_schema = 'my_db' 
    AND table_name = 'my_tab_name' 
; 

有關列的信息:

SELECT 
     table_name 
    , column_name 
    , column_comment 
FROM 
    information_schema.columns 
WHERE 
     table_schema = 'my_db' 
    AND table_name = 'my_tab_name' 
; 

它只是爲我工作。


另外一個

SHOW TABLES FROM information_schema; 

爲您提供所有可用的 「信息表」。


和/或使用快捷方式,如 「Show Comment of Fields FROM Mysql Table

SHOW FULL COLUMNS FROM my_tab_name;