postgresqlfedora-25

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


I’m trying to install PostgreSQL on a Fedora 25.

I have edited postgresql.conf to include:

listen_addresses = '*'  
port = 5432

I have edited pg_hba.conf to include:

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

Both can be seen as desperate, but I’m trying to get a connection.

I can access the PostgreSQL server via command line psql

But I can’t establish a connection via pgadmin3 – using the same login credentials.

I get the following message:

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. 

Can anybody see any obvious errors, or suggest possibilities I can try.


Solution

  • For testing, you can try with pg_hba.conf lines like this (the first line is for IPv4, the second one for IPv6):

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

    This allows all network connections to succeed without a password, so do not leave these lines in after testing.

    Note that pg_hba.conf is processed from top to bottom, and the first matching line is used. So you want to put the lines at the very top.

    After you have reloaded with pg_ctl reload, check the PostgreSQL log file if there were any errors in your configuration file.