I'm not able to login to PostgreSQL because it's not letting me in, saying password authentication failed.
Info
Using PostgreSQL on an M1 Mac. Installed Postgres through brew.
pg_hba.conf(not including the comments on top of the file):
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
Error
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: password authentication failed for user "adithraghav"
Description
I've been getting this error ever since I restarted my M1 MacBook Air. Before restarting, it worked fine. Because of this error, I reinstalled Postgres, but still I get this error, even though I never created this user. I thought it might be something PostgreSQL created on its own based on my computer's login details, and I entered my computer's login details, but still no luck.
I can start the server with brew services start postgres, but I can't get into the PostgreSQL prompt.
I think I've forgotten the password or it has set the password on its own
What should I do to solve this problem? Should I reinstall PostgreSQL, this time making note to delete some extra information? Should I reset the password in some way? Is there some sort of forgot password option? What can I do to access the prompt?