[英]django.db.utils.OperationalError: FATAL: password authentication failed for user "postgres"
Please help!请帮忙!
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"
My settings are local all all @authmethodlocal@我的设置都是本地所有@authmethodlocal@
It's like I can't get into my user "postgres" or "ladonna".这就像我无法进入我的用户“postgres”或“ladonna”。
I was running python3 manage.py runserver我正在运行 python3 manage.py runserver
local host, 5432, etc are default本地主机、5432 等是默认值
The user postgres has no DB password by default.默认情况下,用户 postgres 没有数据库密码。 So, Check the file /etc/postgresql/10/main/pg_hba.conf: And change it to
因此,检查文件 /etc/postgresql/10/main/pg_hba.conf: 并将其更改为
local all postgres peer
Or Inside the psql shell you can set the password for user postgres或者在 psql shell 中,您可以为用户 postgres 设置密码
ALTER USER postgres PASSWORD 'yourPassword';
After setting password, add password in django settings for user postgres.设置密码后,在django设置中为用户postgres添加密码。
this error is not due to django this error is coming from postgresql and its sayig that connection is failing to the server due to password authentication failed.. so 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 pg_hba.conf file....you can search them in link这个错误不是由于 django 这个错误来自 postgresql 并且它说由于密码身份验证失败,连接到服务器失败..所以检查你输入的用户的密码。在 django settings.py 如果这不是'有时您必须在 pg_hba.conf 文件中进行一些更改....您可以在链接中搜索它们
Visit https://manuals.xtuple.com/prodguide/admin-guide/ch01s12s01s01.html访问https://manuals.xtuple.com/prodguide/admin-guide/ch01s12s01s01.html
if this dont work you can check your port on which this is working.如果这不起作用,您可以检查您的端口。 by command
sudo netstat -plunt |grep postgres
通过命令
sudo netstat -plunt |grep postgres
and change the port in your settings.py并更改 settings.py 中的端口
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.