如何授予用户特权以授予其他用户mysql中的只读访问权限

时间:2019-05-16 09:30:36

标签: mysql grant

我试图授予用户所有特权,并授予他们授予其他用户仅SELECT访问权限的特权。

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

  

通过GRANT OPTION将所有数据库全部授予[user1]

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

谢谢

1 个答案:

答案 0 :(得分:0)

首先,检查this topic

第二,如果您授予访问权限为“所有特权”,则该用户将自动具有向其他用户授予READONLY访问权限的选项。

以下是最常用的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';