使用Navicat连接PG时报错authentication method 10 not supported
Tags: md5NavicatPGscram-sha-256故障处理
现象
在使用Navicat Premium 12版本连接pg 12数据库时,报错“authentication method 10 not supported”,如下:
其中,pg_hba.conf文件的内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 | # "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 |
解决
在确保参数listen_addresses = '*'
,并且pg_hba.conf支持远程连接的条件下,执行pg_ctl reload
后,还是报错。
这个主要原因是认证方式使用的是scram-sha-256
或md5
,而客户端的Navicat的libpq.dll
并不支持scram-sha-256
和md5
。
所以,解决方法是将最新的PG版本的libpq.dll
文件拷贝到Navicat的安装目录中,我拷贝的是PG14版本的文件,如下:
最后,重新连接即可。
另外,也可以将pg_hba.conf文件中的支持远程连接的验证方式修改为trust或password也可以解决问题:
1 | host all all all trust |
最后,说到底是Navicat的版本太低导致的,所以,也可以升级你的Navicat软件也可以解决问题。
参考
https://stackoverflow.com/questions/64474420/postgresql-authentication-method-10-not-supported