# SHOW GRANTS

## Syntax

```sql
SHOW GRANTS [FOR user|role]
```

## Description

The `SHOW GRANTS` statement lists privileges granted to a particular user or role.

### Users

The statement lists the [GRANT](/docs/server/reference/sql-statements/account-management-sql-statements/grant.md) statement or statements that must be issued to duplicate the privileges that are granted to a MariaDB user account. The account is named using the same format as for the`GRANT` statement; for example, '`jeffrey'@'localhost`'. If you specify only the user name part of the account name, a host name part of '`%`' is used. For additional information about specifying account names, see [GRANT](/docs/server/reference/sql-statements/account-management-sql-statements/grant.md).

```sql
SHOW GRANTS FOR 'root'@'localhost';
+---------------------------------------------------------------------+
| Grants for root@localhost                                           |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
```

To list the privileges granted to the account that you are using to connect to the server, you can use any of the following statements:

```sql
SHOW GRANTS;
SHOW GRANTS FOR CURRENT_USER;
SHOW GRANTS FOR CURRENT_USER();
```

If `SHOW GRANTS FOR CURRENT_USER` (or any of the equivalent syntaxes) is used in `DEFINER` context (such as within a stored procedure that is defined with`SQL SECURITY DEFINER`), the grants displayed are those of the definer and not the invoker.

### Roles

`SHOW GRANTS` can also be used to view the privileges granted to a [role](/docs/server/security/user-account-management/roles.md).

#### Example

```sql
SHOW GRANTS FOR journalist;
+------------------------------------------+
| Grants for journalist                    |
+------------------------------------------+
| GRANT USAGE ON *.* TO 'journalist'       |
| GRANT DELETE ON `test`.* TO 'journalist' |
+------------------------------------------+
```

{% tabs %}
{% tab title="Current" %}
**FOR PUBLIC**

[GRANT ... TO PUBLIC](/docs/server/reference/sql-statements/account-management-sql-statements/grant.md#to-public) grants privileges to all users. `SHOW GRANTS FOR PUBLIC` shows all these grants.

```sql
SHOW GRANTS FOR public;
+------------------------------------------------+
| Grants for PUBLIC                              |
+------------------------------------------------+
| GRANT ALL PRIVILEGES ON `dev_db`.* TO `PUBLIC` |
+------------------------------------------------+
```

{% endtab %}

{% tab title="< 10.11" %}
`FOR PUBLIC` is not available.
{% endtab %}
{% endtabs %}

## See Also

* [Authentication from MariaDB 10.4](/docs/server/security/user-account-management/authentication-from-mariadb-10-4.md)
* [SHOW CREATE USER](/docs/server/reference/sql-statements/administrative-sql-statements/show/show-create-user.md) shows how the user was created.
* [SHOW PRIVILEGES](/docs/server/reference/sql-statements/administrative-sql-statements/show/show-privileges.md) shows the privileges supported by MariaDB.
* [Roles](/docs/server/security/user-account-management/roles.md)

<sub>*This page is licensed: GPLv2, originally from*</sub> [<sub>*fill\_help\_tables.sql*</sub>](https://github.com/MariaDB/server/blob/main/scripts/fill_help_tables.sql)

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-grants.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
