gpt4 book ai didi

Stuck at running an instance of Postgres via docker-compose [closed](通过docker-compose[关闭]运行postgres实例时停滞不前)

转载 作者:bug小助手 更新时间:2023-10-25 15:55:50 31 4
gpt4 key购买 nike




I have this docker-compose.yml file:

我有这个docker-compose.yml文件:


version: '3.1'

services:

db:
image: postgres
restart: always
environment:
POSTGRES_USER: qQmhGTYnBEqfokY3p64x
POSTGRES_PASSWORD: HydJ47qr4F7XqsFhcTsL
POSTGRES_DB: db

adminer:
image: adminer
restart: always
ports:
- 8080:8080

And when I run it, and I go to localhost:8080, choose PostgreSQL and set db as the default database, and use that use/pass, I get this error:

当我运行它时,我转到localhost:8080,选择PostgreSQL并将db设置为默认数据库,然后使用该USE/PASS,我收到以下错误:



Unable to connect to PostgreSQL server: FATAL: password authentication failed for user "qQmhGTYnBEqfokY3p64x"



And from the docker log, I get:

从码头日志中,我得到了:



db_1 | 2023-09-10 13:09:20.373 UTC [33] FATAL: password authentication failed for user "qQmhGTYnBEqfokY3p64x"

db_1 | 2023-09-10 13:09:20.373 UTC [33] DETAIL: Role "qQmhGTYnBEqfokY3p64x" does not exist.



What have I done wrong?

我做错了什么?


更多回答

Hasan, if the user, and password are the real user and password, please anonymize them now. Also, why are you combining MariaDB and PostgreSQL?

哈桑,如果用户和密码是真实的用户和密码,请现在匿名。还有,为什么要把MariaDB和PostgreSQL结合起来呢?

@Uberhumus, those are fake username passwords. Thank you for mentioning and helping. I updated the question, I use PostgreSQL.

@Uberhumus,这些都是假的用户名密码。谢谢你的提及和帮助。我更新了问题,我使用PostgreSQL。

I can't reproduce your problem, I can log in without any problem from adminer with the given user/pass after starting the compose services from the above file.

我无法重现您的问题,在从上面的文件启动组合服务后,我可以使用给定的用户/PASS从管理员登录而没有任何问题。

@Zeitounator, after restarting my linux, it worked. Maybe there was a problem with the docker itself.

@Zeitounator,重启我的Linux后,它起作用了。也许是码头本身出了问题。

优秀答案推荐

Simple example

简单的例子


version: '3.8'
services:
postgres:
image: postgres:10.5
restart: always
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=postgres
ports:
- '5438:5432'
volumes:
- ./postgres-data:/var/lib/postgresql/data
- ./sql/create_tables.sql:/docker-entrypoint-initdb.d/create_tables.sql
- ./sql/fill_tables.sql:/docker-entrypoint-initdb.d/fill_tables.sql

You should create two scripts,to create and fill tables at your entrypoint.

您应该创建两个脚本,以在入口点创建和填充表。


更多回答

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com