我在从不同主机连接到 PostgreSQL 服务器时遇到错误,我配置了两者postgresql.conf,pg_hba.conf 但不幸的是没有结果。
所以我已经从包中在 Debian 上安装了 PostgreSQL,添加了用户createuser和useradd,然后通过createdb作为我的自定义用户作为所有者创建了 db 。之后我设置postgresql.conf了这些值
listen_addresses = '*'
ssl = false
Run Code Online (Sandbox Code Playgroud)
并添加了这一行 pg_hba.conf
host all all 192.168.0.0/24 md5
Run Code Online (Sandbox Code Playgroud)
然后我重新启动了服务并尝试通过我的机器连接psql -U admin -d admin -h 10.10.30.88,我收到此错误
psql: FATAL: no pg_hba.conf entry for host "192.168.10.195", user "admin", database "admin", SSL off
Run Code Online (Sandbox Code Playgroud)
那么我是不是忘记了什么?
所有的 pg_hba.conf
local all postgres peer
local all all peer
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all …Run Code Online (Sandbox Code Playgroud)