'trying to use pg dump but password is not working

I've been trying to use pg_dump but I keep getting the error:

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"

I've tried changing the pg_hba file from enter image description here

To enter image description here

I've been searching but nothings working, am I missing something



Solution 1:[1]

The pg_hba.conf file is read sequentially, and your entries are located and the end, please add your entries at the beginning, and don't forget to run a reload

The doc: 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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anthony Sotolongo