小编Qey*_*hon的帖子

在 Postgres 9.5 中具有所有权限的用户的对等身份验证失败

我想创建一个只能访问指定数据库的用户。但是,它应该具有所有权限。我在 Ubuntu 14.04 上使用 Postgresql 9.5。所以首先,我创建一个新用户:

$createuser --interactive joe
  Shall the new role be a superuser? (y/n) n
  Shall the new role be allowed to create databases? (y/n) n
  Shall the new role be allowed to create more new roles? (y/n) n
Run Code Online (Sandbox Code Playgroud)

接下来,我使用所有者 joe 创建一个新数据库:

 $sudo -u postgres psql 
 $CREATE DATABASE myDB OWNER joe;
 $GRANT ALL ON DATABASE myDB TO joe;
Run Code Online (Sandbox Code Playgroud)

之后,我尝试与用户 joe 连接以连接到我的数据库 myDB:

$psql myDB -U joe
psql: FATAL:  Peer authentication failed for user "joe" 
Run Code Online (Sandbox Code Playgroud)

我接下来必须做什么?

postgresql privileges

16
推荐指数
1
解决办法
5万
查看次数

标签 统计

postgresql ×1

privileges ×1