Reputation: 31
My settings are local all @authmethodlocal@.
It's like I can't get into my user "postgres" or "ladonna".
I was running python3 manage.py runserver.
local host, 5432, etc are default.
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/psycopg2/__init__.py", line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL: password authentication failed for user "postgres"
Upvotes: 3
Views: 12716
Reputation: 69
This error is not due to Django, this error is coming from PostgreSQL and it is saying that the connection to the server is failing because password authentication failed. Check the password of the user you are entering in Django settings.py.
If this doesn't work sometimes you have to make some changes in the pg_hba.conf file. Visit xTuple Admin Guide - Edit your pg_hba.conf file.
If this doesn't work, you can check your port on which this is working by using command
sudo netstat -plunt |grep postgres
and change the port in your settings.py.
Upvotes: 0
Reputation: 1609
The user postgres has no DB password by default. So, Check the file /etc/postgresql/10/main/pg_hba.conf: And change it to
local all postgres peer
Or Inside the psql shell you can set the password for user postgres
ALTER USER postgres PASSWORD 'yourPassword';
After setting password, add password in django settings for user postgres.
Upvotes: 2