【发布时间】:2021-11-14 05:55:51
【问题描述】:
项目正在运行,使用 Java 并在服务器上旋转。 我正在尝试连接到 postgresql 数据库并收到此错误:
FATAL: password authentication failed for user "postgres"
这里是来自文件 application.xml 的设置
spring:
profiles:
active: @spring.profiles.active@
jpa:
hibernate:
ddl-auto: none
datasource:
initialization-mode: always
platform: convert
driver-class-name: org.postgresql.Driver
username: postgres
password: postgres
url: jdbc:postgresql://localhost:5432/mark_convert
jdbc-url: jdbc:postgresql://localhost:5432/mark_convert
liquibase:
change-log: classpath:db/changelog.xml
这里是 Docker-compose 文件
postgres-converter:
container_name: postgres-converter
image: postgres:13.2-alpine
restart: unless-stopped
ports:
- "5435:5432"
environment:
- POSTGRES_USER=postgres
- POSTGRES_DB=converter
- POSTGRES_PASSWORD=postgres
volumes:
- ./postgres_converter_data:/var/lib/postgresql/data
如果有人更改了数据库中的密码,那么 Java 应用程序将无法使用此数据库?
我会给你另一个关于 liquibase 的文件,但它更让我困惑,显示的名称完全不同。
<createTable tableName="converter_history" schemaName="history">
<column name="id" type="BIGINT" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="type" type="varchar(20)"/>
<column name="pic_number" type="varchar(4)"/>
<column name="part_number_oem" type="varchar(50)"/>
<column name="date_added" type="timestamp" defaultValueComputed="current_timestamp">
<constraints nullable="false"/>
</column>
<column name="result" type="varchar(50)">
<constraints nullable="false"/>
</column>
</createTable>
【问题讨论】:
-
看起来您的数据库名称是
converter,但在application.xml的连接字符串中,数据库名称是mark_convert! -
这也误导了我。但是这个项目的开发者已经消失了,也没有人问。我试图在连接中指定数据库名称 mark_convert。同样的错误。
标签: java spring postgresql