“SHOW TABLE STATUS”的适当权限在MySQL中

发布于 2024-10-03 04:01:48 字数 174 浏览 8 评论 0原文

我可以对 MySQL 数据库中的表进行插入、更新、删除等操作,但无法显示表状态。有谁知道执行此操作需要哪些权限?

这是我的错误消息:

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

I can insert, update, delete, etc. to a table in my MySQL database but I cannot show the table status. Does anyone know which privilege(s) is needed to do this?

Here is my error message:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

全部不再 2024-10-10 04:01:48

我只需要最小(仅选择)权限即可获取表状态。 mysql是什么版本的?

grant select on test_dev.districts to td3@localhost identified by 'monkey';

然后:

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

有效。

这会给你带来什么回报?

show grants for admin459@localhost;

Minimal (select only) privileges is all I need to get table status. What version of mysql?

grant select on test_dev.districts to td3@localhost identified by 'monkey';

then:

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

works.

what does this return for you?

show grants for admin459@localhost;
幻想少年梦 2024-10-10 04:01:48

看起来很奇怪......即使我的 MySQL 用户具有最小的权限也可以在各自的数据库上执行 SHOW TABLE STATUS 操作。

您能举一个您正在尝试的确切语法的示例吗?

例如 在示例中显示表状态,如“用户”

Seems odd... even my MySQL users with minimal priveledges can do SHOW TABLE STATUS's on their respective databases.

Can you give an example of the exact syntax you're attempting?

e.g. SHOW TABLE STATUS IN sample LIKE 'users'

困倦 2024-10-10 04:01:48

也许尝试另一种方式来查看有关特定表的所有信息,
特别是列注释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;

Maybe try another way to view all the information about a particular table,
especially the column comments (beside "access denied" during SHOW TABLE STATUS):

Access the INFORMATION_SCHEMA of the database directly (if you have the
SELECT-privilege).

For Information about the table itself (normally one tupel):

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

For Information about columns:

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

It just worked for me.

Furthermore a

SHOW TABLES FROM information_schema;

offers you all the available "information-tables".

And/or use a shortcut, as mentioned in "Show Comment of Fields FROM Mysql Table"

SHOW FULL COLUMNS FROM my_tab_name;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文