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!
Login and Connect as Default User For most systems, the default Postgres user is postgres and a password is not required for authentication.
By Default, the user is 'postgres' and the password is the one which you enter while installing the database. (Version 11,12 I have tested). and enter the password used while installing. Or create a user with login permissions using PgAdmin tool.
Run the query from pgadmin: SELECT rolname, rolpassword FROM pg_authid; This requires superuser privileges to protect the password.
Through trial and error I found that the password for Postgre SQL 10 for the username postgres is "admin". I kept typing in different password until I reached that password. I am using pgAdmin 4 to test out my SQL Statements, POSTGRE SQL 10 is the first server connection set up using localhost.
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.
Just for reference: I ran into the same issue on ubuntu-20.04 running postgresql-13.1. To solve it with this configuration I had to run the following commands in the terminal:
sudo su postgres
psql
\password postgres
Afterwards, I could log in through pgAdmin4 as usual, providing the set password.
The method that worked for me (Windows 10 x64, PostgreSQL 13):
pg_ctl reload
, press Enter.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With