PostgreSQL pg_hba.conf 问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6643050/
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
PostgreSQL pg_hba.conf Issue
提问by Nick Binnet
In pg_hba.conf, I have
在 pg_hba.conf 中,我有
host all all 127.0.0.1/32 md5
host all all samenet md5
I also added
我还加了
host all all samehost md5
on both.
双方。
I am using pgAdminIII, trying create a "New Server Registration". When I connect to (localhost), it works fine. But when I change the host to the actual workstation name it says:
我正在使用 pgAdminIII,尝试创建一个“新服务器注册”。当我连接到(本地主机)时,它工作正常。但是当我将主机更改为实际的工作站名称时,它说:
FATAL: no pg_hba.conf entry for host "fe80::c81c:9e9c:6570:d0bf%20", user "postgres", database "postgres", SSL off
Additional Information
附加信息
- Operating system: Windows 7 Ultimate 32 bit
- PostgreSQL Server 9.0.2
- 操作系统:Windows 7 Ultimate 32 位
- PostgreSQL 服务器 9.0.2
Any help on this would be highly appreciated.
对此的任何帮助将不胜感激。
采纳答案by user1232564
This is the issue of PostgreSQL installations on Windows computers having IPv6 enabled. Temporary workaround would be passing paramter "-h 127.0.01" as described in this article.
这是在启用了 IPv6 的 Windows 计算机上安装 PostgreSQL 的问题。临时解决方法是传递参数“-h 127.0.01”,如本文所述。
http://postgresql.1045698.n5.nabble.com/FATAL-no-pg-hba-conf-entry-for-host-1-td1873063.html
http://postgresql.1045698.n5.nabble.com/FATAL-no-pg-hba-conf-entry-for-host-1-td1873063.html
回答by null
This has been answered by other user here, but I want to show the answer here to make more clear for others:
这已由其他用户在此处回答,但我想在此处显示答案以使其他人更清楚:
In pg_hba.conf, add your ipv6 address like this:
在 pg_hba.conf 中,像这样添加你的 ipv6 地址:
host all all fe80::c81c:9e9c:6570:d0bf/128 md5
fe80::c81c:9e9c:6570:d0bf is your ipv6 address.
fe80::c81c:9e9c:6570:d0bf 是你的 ipv6 地址。
回答by Peter Eisentraut
Note that the interface enumeration code that samehost
and samenet
rely on is very platform-dependent. (There are currently 5 separate implementations for different platforms.) So what works for one setup might not work somewhere else.
注意接口枚举代码samehost
和samenet
依赖是非常依赖于平台的。(目前针对不同平台有 5 种不同的实现。)因此,适用于一种设置的方法可能不适用于其他地方。
That said, the analogous setup works for me on Linux, that is, I can connect to the database server on the local host using
也就是说,类似的设置在 Linux 上对我有用,也就是说,我可以使用连接到本地主机上的数据库服务器
psql -d postgres -h 'fe80::xxxx:xxxx:xxxx:xxxx%eth0'
after setting listening_addresses
and samenet
appropriately.
设置listening_addresses
和samenet
适当后。
So it's conceivable that the interface enumeration code in Windows somehow fails to include the link-local addresses.
因此可以想象,Windows 中的接口枚举代码以某种方式未能包含链接本地地址。
If you have isolated this problem enough, I would send a bug report to PostgreSQL to analyze the issue further.
如果您已经足够隔离这个问题,我会向 PostgreSQL 发送错误报告以进一步分析问题。
回答by John Childress
I had the same problem and solved it by turning off ipv6 support on both machines. Not sure if this is an option for you.
我遇到了同样的问题,并通过关闭两台机器上的 ipv6 支持来解决它。不确定这是否适合您。
回答by efesar
You can also use
你也可以使用
host all all ::1/128 md5
for the localhost.
对于本地主机。
回答by Denis Dragovic
Turn off IPV6 on adapters that you can. After that, do
尽可能关闭适配器上的 IPV6。之后,做
netsh interface teredo set state disabled
This will disable virtual network interfaces that you can't see from GUI.
这将禁用您无法从 GUI 中看到的虚拟网络接口。