Difference between revisions of "MySQL - Delete privileges of a user"
Line 3: | Line 3: | ||
'''Delete (revoke) all privileges of a user:'''<br> | '''Delete (revoke) all privileges of a user:'''<br> | ||
− | REVOKE ALL PRIVILEGES ON mytable.* FROM 'myuser'@'localhost'; | + | <pre>REVOKE ALL PRIVILEGES ON mytable.* FROM 'myuser'@'localhost';</pre> |
<br> | <br> | ||
'''Delete (revoke) a certain privilege of a user:'''<br> | '''Delete (revoke) a certain privilege of a user:'''<br> | ||
− | REVOKE DELETE ON mytable.* FROM 'myuser'@'localhost'; | + | <pre>REVOKE DELETE ON mytable.* FROM 'myuser'@'localhost';</pre> |
<br> | <br> | ||
'''Delete (revoke) certain privilges of a user:'''<br> | '''Delete (revoke) certain privilges of a user:'''<br> | ||
− | REVOKE DELETE, SELECT ON mytable.* FROM 'myuser'@'localhost'; | + | <pre>REVOKE DELETE, SELECT ON mytable.* FROM 'myuser'@'localhost';</pre> |
<br> | <br> | ||
<br> | <br> |
Latest revision as of 17:43, 14 April 2020
Use the same privileges string as it is displayed in the output of the command "show grants for 'myuser'@'localhost';"
Delete (revoke) all privileges of a user:
REVOKE ALL PRIVILEGES ON mytable.* FROM 'myuser'@'localhost';
Delete (revoke) a certain privilege of a user:
REVOKE DELETE ON mytable.* FROM 'myuser'@'localhost';
Delete (revoke) certain privilges of a user:
REVOKE DELETE, SELECT ON mytable.* FROM 'myuser'@'localhost';
ALTERNATIVE: Delete the user and add him then again
drop user [email protected];
More info:
https://dev.mysql.com/doc/refman/8.0/en/show-grants.html