解决方案一:(配置conf)
pg_hba.conf文件的内容如下:
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
host all all all scram-sha-256
#hostssl all all all cert
编辑/var/lib/pgsql/13/data/postgresql.conf
增加
listen_addresses = ‘*’
编辑/var/lib/pgsql/13/data/pg_hba.conf
增加:
host all all 0.0.0.0/0 password
然后重启 systemctl restart postgresql-13
解决方案二:(navicat认证版本低)
在确保参数listen_addresses = ‘*’,并且pg_hba.conf支持远程连接的条件下,执行pg_ctl reload后,还是报错。
这个主要原因是认证方式使用的是scram-sha-256或md5,而客户端的Navicat的libpq.dll并不支持scram-sha-256和md5。
所以,解决方法是将最新的PG版本的libpq.dll文件拷贝到Navicat的安装目录中
(或者用其他连接软件连接)