1、使用postgres登录pgsql

sudo -u postgres psql postgres -p 5432

2、添加名为iuser的用户,并设置密码

create user iuser with password '123123';

3、给iuser用户,创建数据库叫work_base

create database work_base owner iuser;

4、授予iuser当前work_base的全部权限

4.1、先退出postgre数据库

exit

4.2、登录work_base数据库

psql -U postgres -d work_base -p 5432

4.3、将work_base的所有权限赋予iuser

grant all privileges on database work_base to iuser;grant usage on schema public to iuser;grant all privileges on all tables in schema public to iuser;grant all privileges on all sequences in schema public to iuser;grant select,insert,update,delete on all tables in schema public to iuser;grant all on schema public to iuser;