# **SHOW GRANTS**

## **Grammar Description**

Use the `SHOW GRANTS` statement to display all authorization information for the user. The `SHOW GRANTS` statement displays permissions assigned to the user using the `GRANT` command.

Using the `SHOW GRANTS` statement requires `SELECT` permissions for all tables under the query *mo_catalog* library, except for the permissions and roles of the current user.

To name an account or role for `SHOW GRANTS`, use the same format as the `GRANT` statement, for example:

```sql
show grants for 'root'@'localhost';
```

## **Grammar Structure**

```sql
SHOW GRANTS FOR {username[@hostname] | rolename};
```

## **Example**

```text
create role role role1;
grant all on table *.* to role1;
grant create table, drop table on database *.* to role1;
create user user1 identified by 'pass1';
grant role1 to user1;
> show grants for 'user1'@'localhost';
+------------------------------------------------------------------------------------------------------------------------------
| Grants for user1@localhost |
+------------------------------------------------------------------------------------------------------------------------------
| GRANT connect ON account `user1`@`localhost` |
| GRANT table all ON table *.* `user1`@`localhost` |
| GRANT create table ON database *.* `user1`@`localhost` |
| GRANT drop table ON database *.* `user1`@`localhost` |
+------------------------------------------------------------------------------------------------------------------------------
4 rows in set (0.00 sec)

mysql> show grants for ROLE role1;
+-----------------------------------------------------+
| Grants for role1 |
+-----------------------------------------------------+
| GRANT table all ON table *.* `role1` |
| GRANT create table ON database *.* `role1` |
| GRANT drop table ON database *.* `role1` |
+-----------------------------------------------------+
3 rows in set (0.00 sec)
```
