# SET ROLE

## Syntax

```
SET ROLE { role | NONE }
```

## Description

The `SET ROLE` statement enables a [role](../../../security/user-account-management/roles), along with all of its associated permissions, for the current session. To unset a role, use `NONE` .

If a role that doesn't exist, or to which the user has not been assigned, is specified, an `ERROR 1959 (OP000): Invalid role specification` error occurs.

An automatic SET ROLE is implicitly performed when a user connects if that user has been assigned a default role. See [SET DEFAULT ROLE](set-default-role).

## Example

```sql
SELECT CURRENT_ROLE;
```

```
+--------------+
| CURRENT_ROLE |
+--------------+
| NULL         |
+--------------+
```

```sql
SET ROLE staff;
SELECT CURRENT_ROLE;
```

```
+--------------+
| CURRENT_ROLE |
+--------------+
| staff        |
+--------------+
```

```sql
SET ROLE NONE;
SELECT CURRENT_ROLE();
```

```
+----------------+
| CURRENT_ROLE() |
+----------------+
| NULL           |
+----------------+
```

<sub>_This page is licensed: CC BY-SA / Gnu FDL_</sub>

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