繁体   English   中英

无法通过 pgadmin3(在 Fedora 上)登录到新的 PostgreSQL 服务器

[英]Can't login to new PostgreSQL server via pgadmin3 (on Fedora)

我正在尝试在 Fedora 25 上安装 PostgreSQL。

我编辑了 postgresql.conf 以包括:

listen_addresses = '*'  
port = 5432

我编辑了 pg_hba.conf 以包括:

local   all all                         trust
local   all all 192.168.0.0/24          trust
local   all all 127.0.0.1/32            trust

两者都可以被视为绝望,但我正在尝试建立联系。

我可以通过命令行 psql 访问 PostgreSQL 服务器

但是我无法通过 pgadmin3 建立连接——使用相同的登录凭据。

我收到以下消息:

Ident authentication failed
The server doesn't accept the current user: The server reports 
FATAL: Ident authentication failed for user "postgres" 
If this message appears, the pg_hba.conf entry found for your client / user / database combination is set to "ident" authentication. Some distributions, e.g. Debian, have this by default. To perform ident based authentication successfully, you need additional setup; see the PostgreSQL help for this. For a beginner, it might be more appropriate to use a different authentication method; MD5 encrypted passwords are a good choice, which can be configured by an entry in pg_hba.conf like this: 
host all all 192.168.0.0/24 md5 
This example grants MD5 encrypted password access to all databases to all users on the private network 192.168.0.0/24. 
You can use the pg_hba.conf editor that is built into pgAdmin III to edit the pg_hba.conf configuration file. After changing pg_hba.conf, you need to trigger a server configuration reload using pg_ctl or by stopping and restarting the server process. 

任何人都可以看到任何明显的错误,或者建议我可以尝试的可能性。

折腾了一番之后……
我的 pg_hba.conf 现在归结为:

# My desperate access - including a very open option...
local all all trust
host all all 0.0.0.0/0 trust

# "local" is for Unix domain socket connections only
local   all             all                                     trust

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust

# IPv6 local connections:
host    all             all             ::1/128                 trust

前两行不适合我,但是当我将最后三行全部使用“信任”时,我获得了访问权限 - 也是通过 pgadmin3

为了测试,您可以尝试使用pg_hba.conf行(第一行用于 IPv4,第二行用于 IPv6):

host all all 0.0.0.0/0 trust
host all all ::0/0     trust

这允许所有网络连接在没有密码的情况下成功,因此在测试后不要留下这些行。

注意pg_hba.conf是从上到下处理的,使用的是第一个匹配的行。 所以你想把线条放在最上面。

使用pg_ctl reload ,如果配置文件中有任何错误,请检查 PostgreSQL 日志文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM