【发布时间】:2019-10-03 12:58:14
【问题描述】:
我正在尝试授予用户所有权限,以及授予他们授予其他用户仅 SELECT 访问权限的权限。
这是我在这里展示的声明:
GRANT ALL ON [database] TO 'user1' WITH GRANT OPTION
但是,这允许 user1 授予其他人与他们自己相同的权限。我只想允许 user1 只授予其他人 SELECT 权限。我问的有可能吗?
谢谢,
【问题讨论】:
我正在尝试授予用户所有权限,以及授予他们授予其他用户仅 SELECT 访问权限的权限。
这是我在这里展示的声明:
GRANT ALL ON [database] TO 'user1' WITH GRANT OPTION
但是,这允许 user1 授予其他人与他们自己相同的权限。我只想允许 user1 只授予其他人 SELECT 权限。我问的有可能吗?
谢谢,
【问题讨论】:
首先,检查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';
【讨论】: