尝试使用 pg dump 但密码无效

trying to use pg dump but password is not working

我一直在尝试使用 pg_dump,但我一直收到错误消息:

C:\Users\ojadi>pg_dump
Password:
pg_dump: error: connection to server at "localhost" (::1), port 5432 failed: FATAL:  password authentication failed for user "ojadi"

我试过将 pg_hba 文件从

我一直在搜索,但没有任何效果,我是不是遗漏了什么

pg_hba.conf文件是按顺序读取的,您的条目位于末尾,请在开头添加您的条目​​,不要忘记运行重新加载

文档:https://www.postgresql.org/docs/current/auth-pg-hba-conf.html

Since the pg_hba.conf records are examined sequentially for each connection attempt, the order of the records is significant. Typically, earlier records will have tight connection match parameters and weaker authentication methods, while later records will have looser match parameters and stronger authentication methods.