加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

PostgreSQL:不允许角色登录

发布时间:2020-12-13 16:28:36 所属栏目:百科 来源:网络整理
导读:我在本地服务器上连接到我自己的postgres数据库时遇到麻烦. 我讨厌了一些类似的问题,并提出了这本手册 https://help.ubuntu.com/stable/serverguide/postgresql.html 所以: pg_hba.conf说: # TYPE DATABASE USER ADDRESS METHOD# "local" is for Unix doma
我在本地服务器上连接到我自己的postgres数据库时遇到麻烦.
我讨厌了一些类似的问题,并提出了这本手册
https://help.ubuntu.com/stable/serverguide/postgresql.html

所以:

pg_hba.conf说:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 trust

那么我创建一个用户并为其分配一个密码:

postgres=# create role asunotest;
CREATE ROLE
postgres=# alter role asunotest with encrypted password '1234';
ALTER ROLE

但它不让我进来:

-bash-4.2$psql -h 127.0.0.1 -U asunotest
Password for user asunotest: 1234
psql: FATAL:  role "asunotest" is not permitted to log in

可能是什么问题呢?

您创建的角色不允许登录.请阅读文档 http://www.postgresql.org/docs/9.0/static/sql-alterrole.html
ALTER ROLE "asunotest" WITH LOGIN;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读