美文网首页
解决"pq: unknown authentication re

解决"pq: unknown authentication re

作者: 道行者 | 来源:发表于2022-12-11 12:03 被阅读0次

    用go连接PostgreSQL,连接时提示"pq: unknown authentication response: 10"。上网搜索,说是将客户端的github.com/lib/pq升级一下,我已经是最新的1.10.7了,且Postgres服务端pg_hba.conf中配置也有:

    host all all all scram-sha-256
    

    按这儿(Feature request: Add support for SCRAM-SHA-256 password authentication · Issue #817 · lib/pq (github.com)
    )所述,应该就行了,可是就是报"pq: unknown authentication response: 10"这个错。

    我将上述链接的代码拷贝下来,试了一下,发现没有错误。看来还是我使用的有问题。上述代码中用是sql.Open,我用的是sqlx.Connect,可能是sqlx的问题。

    将sqlx从版本1.2.0升级为1.3.5,问题解决!

    相关文章

      网友评论

          本文标题:解决"pq: unknown authentication re

          本文链接:https://www.haomeiwen.com/subject/wqztqdtx.html