REVOKE
This page is part of MariaDB's Documentation.
The parent of this page is: SQL Statements for MariaDB Xpand
Topics on this page:
Overview
Removes privileges granted to a user account or security role.
USAGE
Common Syntax:
REVOKE <privilege_type> [, <privilege_type>] ...
ON {<privilege_target_name>
| TABLE <tbl_name>
| FUNCTION <func_name>
| PROCEDURE <proc_name>}
FROM <user_name> [@ <host_name>] [, <user_name> [@ <host_name>] ] ...
REVOKE ALL PRIVILEGES, GRANT OPTION
FROM <user_name> [@ <host_name>] [, <user_name> [@ <host_name>] ] ...
DETAILS
MariaDB Xpand's REVOKE
statement has some differences from MariaDB Enterprise Server:
The user account can't be specified using
CURRENT_USER
,CURRENT_USER()
, orSESSION_USER()
The
_
and%
wildcards are not supported in database name specificationsValues supplied for
column_list
andobject_type
are ignored
EXAMPLES
Revoke Specific Privileges
Let's create a new user and grant privileges for a specific database:
CREATE USER usr1;
GRANT SELECT, INSERT, UPDATE, DELETE
ON db1.*
TO 'usr1'@'%';
SHOW GRANTS FOR usr1\G
*************************** 1. row ***************************
Grants for usr1@%: GRANT DELETE, INSERT, SELECT, UPDATE ON `db1`.* TO 'usr1'@'%'
To revoke a specific set of privileges for a database:
REVOKE INSERT, UPDATE, DELETE
ON db1.*
FROM 'usr1'@'%';
SHOW GRANTS FOR usr1\G
*************************** 1. row ***************************
Grants for usr1@%: GRANT SELECT ON `db1`.* TO 'usr1'@'%'
Revoke All Privileges
To revoke all privileges from a user:
REVOKE ALL PRIVILEGES, GRANT OPTION
FROM 'usr1'@'%';
SHOW GRANTS FOR usr1\G
*************************** 1. row ***************************
Grants for usr1@%: GRANT USAGE ON *.* TO 'usr1'@'%'