1

I have created a database foo and tables bar1 and bar2 in this database. I am trying to grant all permissions on these tables to a user myuser - specifically DML.

I created the user as follows:

yugabyte=# CREATE USER myuser

I have also created the database and the corresponding tables in it as the root user.

First, I tried the following but this did not help:

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

Next, per some postgresql steps, I tried the following. This did not work as well.

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

I am guessing that my table is not in the public schema? Or is there another way to achieve this?

1 Answers1

1

You need to run GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO myuser; on database foo. From the above snippet, it looks like you're running it on database yugabyte.

This should work:

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
Neha
  • 116
  • 2