-
locate data folder and
pg_hba.conf
inside, for exampleC:\Program Files\PostgreSQL\12\data\pg_hba.conf
; -
open the file, you'll see:
# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5
- change top 2
md5
totrust
, so it goes:
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
-
launch terminal as administrator
-
run command
pg_ctl.exe reload -D "C:\Program Files\PostgreSQL\12\data\"
(pg_ctl.exe
is inC:\Program Files\PostgreSQL\12\bin
folder) -
now login to postgres
psql -U postgres
- logging as user postgres. Terminal will showpostgres=#
-
run
alter user postgres with password 'YOUR NEW PASSWORD @#$@#$@#';
- on success it will output
ALTER ROLE
;