【问题标题】:How to give privilege to user to grant other users read only access in mysql如何授予用户权限以授予其他用户在mysql中的只读访问权限
【发布时间】:2019-10-03 12:58:14
【问题描述】:

我正在尝试授予用户所有权限,以及授予他们授予其他用户仅 SELECT 访问权限的权限。

这是我在这里展示的声明:

GRANT ALL ON [database] TO 'user1' WITH GRANT OPTION

但是,这允许 user1 授予其他人与他们自己相同的权限。我只想允许 user1 只授予其他人 SELECT 权限。我问的有可能吗?

谢谢,

【问题讨论】:

    标签: mysql grant


    【解决方案1】:

    首先,检查this topic

    其次,如果您以“ALL PRIVILEGES”的身份授予访问权限,那么用户将自动可以选择授予其他用户只读访问权限。

    以下是最常用的 MySQL 权限列表:

            ALL PRIVILEGES – grants all privileges to the MySQL user
            CREATE – allows the user to create databases and tables
            DROP - allows the user to drop databases and tables
            DELETE - allows the user to delete rows from specific MySQL table
            INSERT - allows the user to insert rows into specific MySQL table
            SELECT – allows the user to read the database
            UPDATE - allows the user to update table rows
    

    这是一个示例语法,其中只授予用户两个权限:

    GRANT SELECT, INSERT, DELETE ON database.* TO 'user'@'localhost';
    

    【讨论】:

    • 我意识到他们可以授予其他用户只读访问权限,但我不希望他们也能够授予其他用户写入权限。我在想象这样的事情.. GRANT ALL ON [database] TO 'user1' WITH GRANT OPTION(SELECT) 我意识到这是不正确的,但为了让我的观点得到理解。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-07
    • 2012-01-19
    • 1970-01-01
    • 2020-11-22
    • 2014-03-14
    • 1970-01-01
    相关资源
    最近更新 更多