H2 Database 简明教程
H2 Database - Grant
Grant 是一条来自 SQL 语法的命令,用于向用户或角色授予表的权限。执行此命令需要管理员权限。此命令会提交此连接中的打开事务。
Grant is a command coming from the SQL grammar used to grant the rights to a table, to a user, or to a role. Admin rights are required to execute this command. This command commits an open transaction in this connection.
在本章中,我们将讨论 Grant 命令的不同场景。
In this chapter, we will discuss the different scenarios of Grant command.
Grant Right
Grant Right 是一条向用户或角色授予表的管理员权限的命令。
Grant Right is a command to provide admin rights to a table, to a user, or to a role.
Grant Alter Any Schema
Grant Alter Any Schema 是一条向特定用户授予模式修改权限的命令。
Grant Alter Any Schema is a command to grant schema altering rights to a respective user.
Syntax
以下是 Grant Alter Any Schema 命令的通用语法。
Following is the generic syntax of the Grant Alter Any Schema command.
GRANT ALTER ANY SCHEMA TO userName
Example
在此示例中,我们将向名为 test_user 的用户授予模式的修改权限。确保 test_user 存在。以下是授予修改权限的查询。
In this example, we will grant altering privileges of a schema to a user named test_user. Make sure that test_user exists. Following is the query to grant altering privileges.
GRANT ALTER ANY SCHEMA TO test_user;
以上查询将产生以下输出。
The above query produces the following output.
Granted successfully to test_user