
新建 database 后,默认的 public schema 是所有 role 都有权限的,只能revoke all on schema public from public,但是也仅在当前 database 生效,以后新建的 database 仍然需要执行一遍。能否新 database 的 public schema 需要手动 rant 给其他角色?
新建 role 后,默认能 connect 到所有 databse,只能revoke connect on database from *role*,而且需要一个一个库来 revoke,能否改为在默认是不能连接的,需要手动 grant connect 权限?
1 encro 2021 年 8 月 19 日 https://www.postgresql.org/docs/12/app-createuser.html CREATE ROLE joe NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN; https://medium.com/coding-blocks/creating-user-database-and-adding-access-on-postgresql-8bfcd2f4a91e sudo -u postgres psql postgres=# create database mydb; postgres=# create user myuser with encrypted password 'mypass'; postgres=# grant all privileges on database mydb to myuser; 如果不行,可能是 hba 文件配置问题。 |
2 dzdh 2021 年 8 月 26 日 |