Skip to main content

SHOW GRANTS

Lists all the privileges that have been explicitly granted to a user or a role.

See also:

Syntax

-- Lists privileges granted to a user
SHOW GRANTS FOR <user_name>;

-- Lists privileges granted to a role
SHOW GRANTS FOR ROLE <role_name>;

Examples

The following code returns all the privileges granted to the user user1:

SHOW GRANTS FOR user1;

---
+-----------------------------------------+
| Grants |
+-----------------------------------------+
| GRANT ALL ON 'default'.* TO 'user1'@'%' |
| GRANT ALL ON *.* TO 'user1'@'%' |
+-----------------------------------------+

The following code returns all the privileges granted to the role role1:

SHOW GRANTS FOR ROLE role1;

---
+-------------------------------------+
| Grants |
+-------------------------------------+
| GRANT SELECT ON 'mydb'.* TO 'role1' |
+-------------------------------------+
Did this page help you?
Yes
No
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today