将数据库中所有表的所有权限授予 YugabyteDB 中的用户

Granting all permissions on all tables in a database to a user in YugabyteDB

我在这个数据库中创建了一个数据库foo和tables bar1bar2。我正在尝试将这些 table 的所有权限授予用户 myuser - 特别是 DML。

我创建的用户如下:

yugabyte=# CREATE USER myuser

我也创建了数据库和相应的 tables 作为 root 用户。

首先,我尝试了以下方法,但这没有帮助:

yugabyte=# GRANT ALL PRIVILEGES ON database foo to user myuser;

接下来,根据一些 postgresql 步骤,我尝试了以下操作。这也不起作用。

yugabyte=# GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO myuser;

我猜我的 table 不在 public 模式中?或者有其他方法可以实现吗?

您需要 运行 GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO myuser; 数据库 foo。从上面的代码片段来看,您似乎 运行 在数据库 yugabyte.

上使用它

这应该有效:

yugabyte=# \c foo
You are now connected to database "foo" as user "yugabyte".
foo=# grant all privileges on all tables in schema public to myuser;
GRANT
foo=# set role myuser;
SET
fooo=> insert into hello values(1),(2);
INSERT 0 2