Das Einrichten der Postgresql-Serververbindung mit pgadmin3 schlägt mit Exception fehl

5510
Eric Leschinski

Ich habe die Postgresql-Datenbank auf Fedora 17 installiert.

Wenn ich eine neue Serververbindung über pgadmin3 erstelle, erhalte ich diesen Fehler in einem Popup-Fenster:

postgresql The server doesn't accept the current user: The server report Ident authentication failed The server doesn't accept the current user: The server reports   FATAL: Ident authentication failed for user "pgadmin"  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.  

Ich habe die in der Fehlermeldung erwähnte Änderung vorgenommen host all all 192.168.0.0/24 md5und zur pg_hba.conf hinzugefügt . Aber ich bekomme immer noch den gleichen Fehler. Was mache ich falsch?

1

1 Antwort auf die Frage

1
Eric Leschinski

Der Fehler, den ich gemacht habe, war, dass ich vergessen habe, die anderen Zeilen, die den Host festgelegt haben, auskommentieren zu lassen, und Postgresql nicht neu zu starten, damit neue Änderungen an dieser Datei wirksam werden. Hier sind die Schritte, die ich verwendet habe:

  1. Finde deine pg_hba.conf, meine ist in/var/lib/pgsql/data/pg_hba.conf

  2. Hier sind die ursprünglichen falschen Inhalte von pg_hba.conf, beachten Sie die beiden Hostleitungen für IPv4 und IPv6:

    # TYPE DATABASE USER ADDRESS METHOD  # "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 ident # IPv6 local connections: host all all ::1/128 ident # Allow replication connections from localhost, by a user with the # replication privilege. #local replication postgres peer #host replication postgres 127.0.0.1/32 ident #host replication postgres ::1/128 ident 
  3. Ich musste diese Zeilen am Ende dieser Datei hinzufügen

    host all all 127.0.0.1/32 md5 #the 32 means only the first 32 bits cannnot change, not the first 24. #I use 32 because only one address will be accessing this server. 
  4. Wenn Sie die anderen Standardzeilen hier nicht auskommentieren, funktioniert dies nicht:

    #host all all 127.0.0.1/32 ident # IPv6 local connections: #host all all ::1/128 ident 
  5. Starten Sie dann postgresql neu.

    [root@rosewill samples ]$ systemctl restart postgresql.service 

Versuchen Sie es nach dem Neustart erneut, und der Fehler ist behoben. Dann kann ich mich mit pgadmin3 am Server anmelden.