# It's fairly simple to solve:
# follow this step:
# go to etc/postgresql/14/main --(assuming your version is 14)
# open terminal in this folder and type
# if nano not installed install first.. it's so good.
sudo nano pg_hba.conf
# repalce all method from peer/md5/ to trust like this
local all all trust
local all all trust
host all all 127.0.0.1/32 trust
host all all a::1/128 trust
ctrl + s
ctrl + x
# then run
sudo service postgresql restart
# then type
sudo -u postgres psql
# after that, type
ALTER USER postgres WITH PASSWORD 'postgres'
# now exit out of it by typing
q
# now run again
sudo service postgresql restart
# That's all you have to do, congrats, everything will work now.