Database Reference
In-Depth Information
Adding and removing privileges
Sometimes it becomes necessary to remove a privilege or two from a user, or to give
them more privileges. Giving additional privileges is easy, just run an additional
GRANT statement with the new rights and they will be added. To remove privileges,
we use the REVOKE statement. It has the following pattern:
REVOKE <privileges> ON <database> FROM <user>;
To remove a GRANT OPTION privilege, specify it in the privileges section. The
following example removes the DELETE and GRANT OPTION permissions from the
todd user:
REVOKE DELETE,GRANT OPTION ON cust.* FROM 'todd'@'%';
To remove all privileges from a user ( 'neil'@'%.example.com' in this example), we
use the following special command:
REVOKE ALL,GRANT OPTION FROM 'neil'@'%.example.com';
We, of course, need to customize the user part to match the user for whom we are
removing privileges. The previous statement is special in that it must be used as
written even if the user doesn't have the GRANT OPTION privilege. If we remove the
GRANT OPTION privilege from it the statement won't run.
Complete documentation of the REVOKE statement is available at: https://mariadb.
com/kb/en/revoke/ .
Showing grants
To show the grants available for a user, we use the SHOW GRANTS command. It has
the following pattern:
SHOW GRANTS FOR <user>;
All we have to do is customize the <user> part with the information of the user we
want to look at. Here is an example:
SHOW GRANTS FOR 'dieter'@'10.2.200.4';
 
Search WWH ::




Custom Search