对等身份验证失败



我正试图通过peewee将我的应用程序连接到postgresql数据库。

config.ini:

[DEFAULT]
discord_key = apikey
# private token from discord developer porter
psql_user = postgres
# username for postgres database
psql_db = test
# database name
owner_id = owner
# discord user ID of bot installation owner.

这是我得到的错误:

File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/peewee.py", line 3033, in __enter__
self.db.connect()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/peewee.py", line 3136, in connect
self._initialize_connection(self._state.conn)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/peewee.py", line 2970, in __exit__
reraise(new_type, new_type(exc_value, *exc_args), traceback)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/peewee.py", line 191, in reraise
raise value.with_traceback(tb)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/peewee.py", line 3133, in connect
self._state.set_connection(self._connect())
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/playhouse/postgres_ext.py", line 471, in _connect
conn = super(PostgresqlExtDatabase, self)._connect()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/peewee.py", line 3866, in _connect
conn = psycopg2.connect(**params)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
peewee.OperationalError: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL:  password authentication failed for user "postgres"

bot.py文件在这里。

AFAIU peewee需要我的psql密码来验证连接,但我不知道如何在配置文件中传递密码。

我不确定你从哪里得到的代码,但看起来可能是硬编码的密码?https://github.com/the-brainiac-1869/Polytopia-ELO-Bot/blob/master/modules/models.py#L25

最新更新