授予角色特权后,Postgres 无法创建数据库
我确信我错过了一些简单的东西,但我创建了以下内容:(
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+-----------------------------------------+-----------
admin | No inheritance, Create DB, Cannot login | {}
postgres | Superuser, Create role, Create DB | {}
wade | | {admin}
请注意,无法登录
和无继承
不会影响发生的情况>wade
,请参阅有关角色成员资格的 PostgreSQL 文档< /a> 了解原因。
但是,当我尝试创建数据库时,我得到:
bin wwilliam$ createdb -U wade test
Password:
createdb: database creation failed: ERROR: permission denied to create database
我缺少什么?
I'm sure I'm missing something simple, but I've created the following:
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+-----------------------------------------+-----------
admin | No inheritance, Create DB, Cannot login | {}
postgres | Superuser, Create role, Create DB | {}
wade | | {admin}
(Note that Cannot login
and No inheritance
don't affect what's happening to wade
, here. See the PostgreSQL documentation for role membership to understand why. —bignose)
However, when I try to create a db, I get:
bin wwilliam$ createdb -U wade test
Password:
createdb: database creation failed: ERROR: permission denied to create database
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
手册摘录:
(强调我的)。
An excerpt from the manual:
(Emphasis mine).
在文档中:
因此您必须在创建数据库之前使用
SET ROLE admin;
激活admin
角色。In documentation:
So you must activate
admin
role usingSET ROLE admin;
before creating DB.