django后台用的是postgresql数据库,但是启动是的时候报如下错误:
psql: FATAL: Ident authentication failed for user “postgres”
这个一般是pg_hba.conf文件中未设置 成功 ,方法如下:
先找出pg_hba.conf的位置 find / -name pg_hba.conf
一般位置如下: /var/lib/pgsql/9.5/data/pg_hba.conf
取消那些注释#, 特别是最后几行
local replication postgres trust
host replication postgres 127.0.0.1/32 trust
host replication postgres ::1/128 trust
然后重新 数据库就好了
service postgresql-9.5 restart
本文介绍了解决Django使用PostgreSQL作为后端数据库时出现的认证失败问题。通过修改pg_hba.conf文件中的配置,将认证方式设置为信任模式,并重启数据库服务,可以有效解决该问题。
1939





