OperationalError:(psycopg2.OperationalError)致命错误:用户的密码验证失败 [英] OperationalError: (psycopg2.OperationalError) FATAL: password authentication failed for user

查看:11814
本文介绍了OperationalError:(psycopg2.OperationalError)致命错误:用户的密码验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相对较新的python和postgresql。我已经继承了一些使用psycopg2和sqlalchemy构建postgresql数据库的代码(python)。
$ b

数据库名为'tetradev',用户'tetra'
在此之上是一个基于浏览器的应用程序,通过瓶子运行,查询数据库以在地图上加载信息。



我最近更改了用户'tetra'的密码,现在我得到了一个


内部服务器错误服务器遇到内部错误,
无法完成请求,服务器超载
或在应用程序中出现错误


在URL上。



通过所有托管的服务器,我得到一个


OperationalError :(psycopg2.OperationalError)致命:密码
身份验证失败,用户
错误。

但是,通过终端,我没有问题直接通过用户'tetra'连接到'tetradev'>。



有关如何解决这个问题的任何想法?

编辑



以下是配置文件中的设置。

  db_NAME = os.getenv 'db_name','tetradev')
db_USER = os.getenv('db_USER','tetra')
db_PASSWD = os.getenv('db_PASSWD','default')
db_HOST = os.getenv('db_HOST','xxx.xx.xxx.xx')
db_PORT = os.getenv('db_PORT',5432)

最后想出了这一个。我最终更新配置文件到正确的密码,但它仍然无法正常工作。

我后来得知环境变量被设置为覆盖配置文件(这些都是通过云服务托管的)。我更新了密码,网址现在可以运行。

学习过程中,注意更改用户名或密码时的注意事项。

I'm relatively new to python and postgresql. I have inherited some code (python) that built a postgresql database using psycopg2 and sqlalchemy.

The database is named 'tetradev' with user 'tetra'

On top of this is a browser based application running via flask that queries the database to load information on a map.

I recently changed the password for the user 'tetra' and now I get a

"Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application"

on the URL.

Through the server where this is all hosted I get a

"OperationalError: (psycopg2.OperationalError) FATAL: password authentication failed for user " error.

However, via the terminal, I have no issues connecting to 'tetradev' via user 'tetra' directly.

Any ideas on how to fix this?

Edit

Below are the settings in the config file.

db_NAME = os.getenv(‘db_NAME', ‘tetradev')
db_USER = os.getenv(‘db_USER', ’tetra’)
db_PASSWD = os.getenv(‘db_PASSWD', 'default')
db_HOST = os.getenv(‘db_HOST', ‘xxx.xx.xxx.xx’)
db_PORT = os.getenv(‘db_PORT', 5432)

解决方案

Finally figured this one out. I did end up updating the config file to the proper password but it still did not work.

I later learned that environmental variables were set that over-rode the config file (this is all being hosted through a cloud service). I updated the password there and the URL now works.

Lesson learned, watch out when changing user names or passwords.

这篇关于OperationalError:(psycopg2.OperationalError)致命错误:用户的密码验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆