dataS
dataS

Reputation: 35

cannot connect to Postgres - password unknown

I can't connect on postgresql.

when i go on pgadmin>server>postgresql, it asked me "please enter the password for the user 'postgres' to connect the server?

I have windows 10 and postgresql 14.

But I don't have this password. What can I do?

enter image description here

Upvotes: 1

Views: 4398

Answers (1)

Arman Fagradyan
Arman Fagradyan

Reputation: 51

The following worked for me.
Change METHOD of all rows in your pg_hba.conf file from scram-sha-256 to trust (C:\Program Files\PostgreSQL\14\data\pg_hba.conf). This will disable password for your DB.
Click on any database in postgresql to use Query Tool.

In Query Tool type ALTER USER postgres WITH PASSWORD 'User_password'; postgres is default username, execute it.
This way you can set up a password for your DB, after that go back to the first step and change it back from trust to scram-sha-256.

Upvotes: 3

Related Questions