> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/current_role.md).

# CURRENT\_ROLE

## Syntax

```bnf
CURRENT_ROLE, CURRENT_ROLE()
```

## Description

Returns the current [role](/docs/server/security/user-account-management/roles.md) name. The return value is a string in the\
utf8 [character set](/docs/server/reference/data-types/string-data-types/character-sets.md).

If there is no current role, `NULL` is returned.

[USER()](/docs/server/reference/sql-functions/secondary-functions/information-functions/user.md) returns the combination of user and host used to login. [CURRENT\_USER()](/docs/server/reference/sql-functions/secondary-functions/information-functions/current_user.md) returns the account used to determine current connection's privileges.

Statements using the `CURRENT_ROLE` function are not [safe for statement-based replication](/docs/server/ha-and-performance/standard-replication/unsafe-statements-for-statement-based-replication.md).

## Examples

```sql
SELECT CURRENT_ROLE;
+--------------+
| CURRENT_ROLE |
+--------------+
| NULL         |
+--------------+

SET ROLE staff;

SELECT CURRENT_ROLE;
+--------------+
| CURRENT_ROLE |
+--------------+
| staff        |
+--------------+
```

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

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