postgresql 如何在 Postgres 中使用 phpPgAdmin

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23194369/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 01:25:00  来源:igfitidea点击:

How to use phpPgAdmin with Postgres

postgresqlphppgadmin

提问by Hyman Chuong

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 :

我已经通过 yum 在 Centos 6.4 64 位上安装了 Postgres 8.4。我也想用 yun 安装的 phpPgAdmin-5.0.4-1 管理 Postgres 数据库(如 MySQL 和 phpMyadmmin) 安装 phpPgAdmin-5.0.4-1 后,我无法通过访问 192.168.7.4/phpPgAdmin/ (192.168.7.4.4) 登录到 phpPgAdmin是我的 Centos 服务器),它总是说“登录失败”,虽然我确定我输入的用户名(postgres)和密码是正确的这是我的信息,希望你能帮助:

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.

提前致谢。

采纳答案by Daniel Vérité

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

您的设置很好,除了pg_hba.conf缺少192.168.7.4.

Consider adding it and reload the postgresql service:

考虑添加它并重新加载 postgresql 服务:

host    all         all         192.168.7.4/32          md5

回答by Olu

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

我尝试了上述解决方案,但仍然收到“登录失败”消息。为了解决这个问题,我必须确保passwordpg_hba.conf文件中设置了 IPv6 。这样做:vi /var/lib/pgsql/9.4/data/pg_hba.conf并相应地进行编辑。然后重新启动 httpd 和 postgresql(无论您使用的是什么版本)