user263850
user263850

Reputation: 39

how to modify existing roles in mysql

I have created roles in mysql.

i would like to give one more privilege to existing role? How can i do?

Ex:

mysql> show grants for 'testing_users'@'localhost' using app_write;
+---------------------------------------------------------------------------+
| Grants for testing_users@localhost                                        |
+---------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `testing_users`@`localhost`                         |
| GRANT INSERT, UPDATE, DELETE ON `app_db`.* TO `testing_users`@`localhost` |
| GRANT `app_write`@`%` TO `testing_users`@`localhost`                      |
+---------------------------------------------------------------------------+
3 rows in set (0.00 sec)

I would like to add select privilege to the 'app_write' existing role

Upvotes: 1

Views: 328

Answers (2)

Golub
Golub

Reputation: 195

GRANT SELECT ON app_db.* TO app_write;

Upvotes: 1

JSowa
JSowa

Reputation: 10572

You have even examples in your question.

GRANT INSERT, UPDATE, DELETE ON `app_db`.* TO `testing_users`@`localhost`

For your case

GRANT SELECT ON `app_db`.* TO `app_write`

Documentation MySQL 5.7 GRANT Statement

Documentation MySQL 8.0 GRANT Statement

Just to complete question. If you want to remove permissions you use statement REVOKE.

REVOKE SELECT ON `app_db`.* FROM `app_write`

Upvotes: 1

Related Questions