I know that this question has been asked other times but I didn't find a solution to this problem!
I downloaded PostgreSQL 13 with pg Admin 4 and when I open it for the first time after installation it asks me for the master password that I was asked to set during installation, after I give the master password and this gets accepted I try to connect to the default server created during the installation: "PostgreSQL 13".
At this point, it asks me for a password for the user "postgres" that I don't know where to find. Specifically, it says: Please enter the password for the user 'postgres' to connect the server - "PostgreSQL 13".
I've already tried all the "default" passwords I managed to find on the internet but the error is always the same:
FATAL: password authentication failed for user "postgres"
I've also tried not to insert any password with the resulting error:
fe_sendauth: no password supplied
I don't know what to do. In PostgreSQL 13 the authentication method is encrypted via scram-sha-256
. I already tried to set the method to trust, restart the mac, and open pg Admin 4 that keeps asking me for the password to access the server.
I've also tried to use the command line tool but end up encountering the same errors.
Finally, this is how my pg_hba.conf
looks like:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all scram-sha-256
# IPv4 local connections:
host all all 127.0.0.1/32 scram-sha-256
# IPv6 local connections:
host all all ::1/128 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all scram-sha-256
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
PS. I've also tried to uninstall PostgreSQL 13, deleting the postgres user and re-download and re-install everything... nothing changed.
If someone could help me would become my savior, thanks beforehand!
I ran into the same problem recently. The solution below works for me. I'm using Windows btw, so you should try equivalent commands in your OS.
METHOD
of all rows in your pg_hba.conf
file from scram-sha-256
to trust
bin
folder of Postgres installation to path, if you haven'tpsql -U postgres
. You won't be asked for password here.\password postgres
pg_hba.conf
to original stateNow you should be able to enter password for postgres
in pgAdmin.