Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use phpPgAdmin with Postgres

I have installed Postgres 8.4 on Centos 6.4 64 bit by yum. I want to manage Postgres Databases with phpPgAdmin-5.0.4-1 installed by yun too (like MySQL and phpMyadmmin) After install phpPgAdmin-5.0.4-1 I cannot login to phpPgAdmin by access 192.168.7.4/phpPgAdmin/ (192.168.7.4 is my Centos server), it always says "Login failed" although I'm sure that I enter username (postgres) and password right Here are my information, hope you can help :

netstat -tupln | grep postmaster
tcp        0      0 0.0.0.0:5432                0.0.0.0:*                   LISTEN      771/postmaster
tcp        0      0 :::5432                     :::*                        LISTEN      771/postmaster

/etc/phpPgAdmin/config.inc.php
$conf['servers'][0]['desc'] = 'PostgreSQL';
$conf['servers'][0]['host'] = '192.168.7.4';
$conf['extra_login_security'] = false;

/var/lib/pgsql/data/postgresql.conf
listen_addresses = '*'

/var/lib/pgsql/data/pg_hba.conf
local   all         all                               ident
# IPv4 local connections:
host    all         all         127.0.0.1/32          ident
# IPv6 local connections:
host    all         all         ::1/128               ident

Thanks in advance.

like image 628
Jack Chuong Avatar asked Apr 21 '14 09:04

Jack Chuong


2 Answers

Your setup if fine except for pg_hba.conf which lacks an entry for 192.168.7.4.

Consider adding it and reload the postgresql service:

host    all         all         192.168.7.4/32          md5
like image 167
Daniel Vérité Avatar answered Sep 30 '22 16:09

Daniel Vérité


I tried the above solution but still got the 'Login Failed' message. To resolve, I had to ensure IPv6 is set to password in the pg_hba.conf file. So do: vi /var/lib/pgsql/9.4/data/pg_hba.conf and edit accordingly. Then restart both httpd & postgresql (whatever the version you are using)

like image 21
Olu Avatar answered Sep 30 '22 14:09

Olu