> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# SHOW ROLES

> SHOW ROLES displays all roles in the system.

## 功能

查看当前系统中的所有角色。如果要查看角色的权限信息，可以使用 `SHOW GRANTS FOR ROLE <role_name>;`，具体参见 [SHOW GRANTS](/documents/cn/4.2/sql-reference/sql-statements/account-management/SHOW_GRANTS.md)。

该命令从 3.0 版本开始支持。

**Tip**

只有拥有 `user_admin` 角色的用户才可以执行此操作。

## 语法

```SQL theme={null}
SHOW ROLES
```

返回字段说明：

| **字段** | **描述** |
| - | - |
| Name | 角色名称。 |

## 示例

查看当前系统中的所有角色。

```Plain theme={null}
mysql> SHOW ROLES;
+---------------+
| Name          |
+---------------+
| root          |
| db_admin      |
| cluster_admin |
| user_admin    |
| public        |
| testrole      |
+---------------+
```

## 相关参考

* [CREATE ROLE](/documents/cn/4.2/sql-reference/sql-statements/account-management/CREATE_ROLE.md)
* [ALTER USER](/documents/cn/4.2/sql-reference/sql-statements/account-management/ALTER_USER.md)
* [SET ROLE](/documents/cn/4.2/sql-reference/sql-statements/account-management/SET_ROLE.md)
* [DROP ROLE](/documents/cn/4.2/sql-reference/sql-statements/account-management/DROP_ROLE.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.