[MDEV-9767] CREATE USER/ROLE and REVOKE disagree Created: 2016-03-20 Updated: 2016-03-20 Resolved: 2016-03-20 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Authentication and Privilege System |
| Affects Version/s: | 10.1.11 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Igor Pashev | Assignee: | Sergei Golubchik |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Description |
|
It might be odd to edit mysql tables directly, but I believe it is common to delete rows from mysql.user and flush privileges to make sure that a user or role does not exist. It seems that any rows in tables_priv or columns_priv remain and it makes impossible to recreate the user or role or revoke all privileges:
|
| Comments |
| Comment by Sergei Golubchik [ 2016-03-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
This is not a bug. We do not support manual editing of privilege tables. You do it on your own risk and it's your responsibility to leave privilege tables in the consistent state. Alternatively, you can use DROP USER and DROP ROLE that will do all the job for you. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Pashev [ 2016-03-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
That's fair. I'm just trying ways around MDEV-9691. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2016-03-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
are you trying to delete and then create that user again? then try CREATE OR REPLACE USER | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Pashev [ 2016-03-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
CREATE OR REPLACE has side effects - deleting mappings (for a role) or password (for a user).
| ||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2016-03-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Of course CREATE OR REPLACE USER will delete the password — I was suggesting a safe alternative to your delete from mysql.user (and delete does not preserve the password either). If you want to "revoke all grants" you can try to delete from mysql.roles_mapping where=.... This is not supported either, but it seems not to leave any artifacts, at least now. |