I've been struggling with an error while trying to log into PostgreSQL:
psql: error: connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL: password authentication failed for user "postgres"
Despite changing the postgres password, the error persisted. After investigating, I found the solution and wanted to share it for anyone facing a similar issue:
sudo nano /etc/postgresql/16/main/postgresql.conf
port = 5433
psql -h localhost -U postgres -p 5433
After making this adjustment, I was able to log in successfully.
I hope this helps anyone encountering the same issue! If anyone has further insights or suggestions, please feel free to share.
The issue is that there is a PostgreSQL server running on port 5432, as you can check using pg_lsclusters
. You need to identify which server instance you actually want to connect to