xxxxxxxxxx
postgres=# grant all privileges on database sample_db to user_name;
xxxxxxxxxx
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA schema_name TO username;
xxxxxxxxxx
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA schema_name TO username;
xxxxxxxxxx
GRANT privilege_list | ALL
ON table_name
TO role_name;
Code language: PostgreSQL SQL dialect and PL/pgSQL (pgsql)
xxxxxxxxxx
sudo -u postgres
psqlpostgres=# create database mydb;
postgres=# create user myuser with encrypted password 'mypass';
postgres=# grant all privileges on database mydb to myuser;