我刚开始玩 PostgreSQL。我的目标是在 postgres 之外创建一个具有所有相同权限的新用户,并为我的 ror 应用程序创建一个数据库。我可以在 postgres 下登录。我确实创建了一个名为 的用户Jason
,这很好,但是当我这样做时,sudo -u username psql
我收到以下错误...
sudo: unknown user: Jason
sudo: unable to initialize policy plugin
我可以通过在我的 postgres 控制台中检查 \dg 来确定用户名是否存在。
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
Jason | Superuser, Create role, Create DB, Replication | {}
postgres | Superuser, Create role, Create DB, Replication | {}
是什么导致了这个问题?另外,我检查了我的本地pg_hba.conf
并拥有我认为正确的设置。
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres peer
#host replication postgres 127.0.0.1/32 md5
#host replication postgres ::1/128 md5