> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-fbfa8bee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 常见 RBAC 查询

> 帮助向用户授予特定权限的查询。

{frontMatter.description}

<div id="introduction">
  ## 简介
</div>

以下是一些常见查询语句，可用于向用户授予特定权限。

<div id="how-do-i-grant-the-same-permissions-as-the-current-user-to-another-user">
  ## 如何将当前用户拥有的相同权限授予另一位用户？
</div>

```sql theme={null}
GRANT CURRENT GRANTS ON *.* TO another_user;
```

<div id="how-do-i-grant-a-specific-permission-to-a-user-based-on-the-grants-of-the-current-user">
  ## 如何基于当前用户的授权向某个用户授予特定权限？
</div>

在下面的示例中，`another_user` 将能够对当前用户的所有数据库和表执行 `SELECT` 命令。

```sql theme={null}
GRANT CURRENT GRANTS(SELECT ON *.*) TO another_user;
```

<div id="how-do-i-grant-a-specific-permission-to-a-user-for-a-specific-database-based-on-the-grants-of-the-current-user">
  ## 如何根据当前用户的授权，为某个数据库中的用户授予特定权限？
</div>

在下面的示例中，`another_user` 将能够对 `my_database` 中的所有表执行 `INSERT` 命令。

```sql theme={null}
GRANT INSERT ON my_database.* TO another_user;
```

<div id="how-do-i-give-access-to-all-grants-for-a-specific-user-based-on-the-default-user">
  ## 如何基于 default 用户为特定用户授予全部授权？
</div>

```sql theme={null}
GRANT default_role TO another_user;
```
