psycopg2.OperationalError: FATAL: password authentication failed for user "postgres" - - -

postgres连接数据库进行数据连接时出现下面着这样的错误:

conn = _connect(dsn, connection_factory=connection_factory, **kwasync)

psycopg2.OperationalError: FATAL:  password authentication failed for user "postgres" - - -

 

 

 

这是我的解决方案:

 

首先进入postgresql更改pg_hba.conf配置:

 

全部改为trust,然后重启服务器,就可以连接使用了

 

 

 

 

 

 

posted @ 2019-04-10 11:19  louissica  阅读(3435)  评论(0编辑  收藏  举报