如果我坚持下列默认设置,我的postgresql连接就能工作:
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all md5
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5现在,我正在尝试允许同一家庭中的另一台计算机连接到当前的服务器,并尝试一些设置。我所做的改变之一是对IPv6本地连接线,是使用我的临时IPv6地址,因为如果我检查我在谷歌上的ip,也就是显示在那里的ip。
# IPv6 local connections:
host all all 1111:2222:a111:a11:b222:11a:abcd:efgs md5(注意这里使用的ip只是一个示例)
但是,这将导致postgresql日志中出现以下错误:
2021-11-21 12:26:40.508 PST [10356] LOG: starting PostgreSQL 13.3, compiled by Visual C++ build 1914, 64-bit
2021-11-21 12:26:40.515 PST [10356] LOG: listening on IPv6 address "::", port 5432
2021-11-21 12:26:40.517 PST [10356] LOG: listening on IPv4 address "0.0.0.0", port 5432
2021-11-21 12:26:40.529 PST [10356] LOG: invalid IP mask "md5": Unknown host
2021-11-21 12:26:40.529 PST [10356] CONTEXT: line 88 of configuration file "C:/current_dir/PostgresSQL/data/pg_hba.conf"
2021-11-21 12:26:40.531 PST [10356] FATAL: could not load pg_hba.conf
2021-11-21 12:26:40.533 PST [10356] LOG: database system is shut down请问造成此错误的可能原因是什么?非常感谢。
发布于 2021-11-22 03:11:42
不能在pg_hba.conf中指定客户端IP地址,必须指定CIDR。每文献资料
IP地址范围使用范围起始地址的标准数字表示法指定,然后是斜杠(
/)和CIDR掩码长度。掩码长度指示必须匹配的客户端IP地址的高阶位数。在给定的IP地址中,右边的位应为零。IP地址、/和CIDR掩码长度之间不得有任何空白。
因此,条目必须看起来像:
host all all fe80::8b0a:b1bf:4ce5:9a4a/128 md5https://stackoverflow.com/questions/70058335
复制相似问题