postgres是连接到具体的库:
./psql -U postgres 不指定库,默认就是用户名的同名库
./psql -d chat -U postgres 指定chat库
postgres登录权限配置文件是在数据目录下的pg_hba.conf
du: 查看用户
dt: 查看表
dn:查看schema
c: 切换连接 如 c postgres postgres 使用postgres用户连接到postgres数据库
d: 查看数据库对象
l:查看数据库
批量给某个用户授权示例
1. 管理员登录: ./psql -U postgres
2. 创建用户: create user chat with password 'chatpasswd'
3. 给用户授权:
1. 先登录到需要授权的库下
./psql -d chat -U postgres
2. 查看schema类型
d
3. 根据schema授权
grant all privileges on all tables in schema public to chat;
grant usage,select on all sequences in shcema public to chat;