我有一个停靠的PSQL实例和一个连接到它的停靠的应用程序.尽管我从未设置密码,但try 连接时仍收到错误的密码错误.默认的postgres
不起作用.
compose.yml
个
services:
psql:
build: database/.
env_file: vars.env
ports:
- "5432:5432"
reader:
build: reader/.
env_file: vars.env
restart: always
reader.py
个
import psycopg2
connection = psycopg2.connect(
database="postgres",
user="postgres",
password="postgres",
host="psql",
port=5432)
cursor = connection.cursor()
误差率
psycopg2.Operational误差率: connection to server at "psql" (172.29.0.3), port 5432 failed: FATAL: password authentication failed for user "postgres"
这个密码可能是什么?或者它是如何设定的.我以为没有设置默认用户或密码.