监听所有请求

/var/lib/pgsql/14/data/postgres.conf

在文件中找到#listen_addresses=’localhost’,把他修改为listen_addresses = ‘*’

1
listen_addresses = ‘*’

设置ip段允许访问PostgreSQL

/var/lib/pgsql/14/data/pg_hba.conf

在IPv4 local connections往下添加以下内容即可

1
2
# IPv4 local connections:
host all all 0.0.0.0/0 scram-sha-256