postgresql - 使用新的 docker-compose 时用户的密码验证失败
问题描述
我正在使用 django-cookiecutter 模板,并且第二次用于新项目。它无法连接到 postgres 并出现以下错误:
postgres_1 | 2018-04-30 14:54:09.747 UTC [1] LOG: database system is ready to accept connections
postgres_1 | 2018-04-30 14:54:10.029 UTC [28] FATAL: password authentication failed for user "IViLGLIEWLBDGBnsAuoOEhtFaKrqKxfX"
postgres_1 | 2018-04-30 14:54:10.029 UTC [28] DETAIL: Role "IViLGLIEWLBDGBnsAuoOEhtFaKrqKxfX" does not exist.
postgres_1 | Connection matched pg_hba.conf line 95: "host all all all md5"
django_1 | PostgreSQL is unavailable (sleeping)...
一位维护者解释了这一点:
the thing is, every time you bootstrap the project POSTGRES_USER and POSTGRES_PASSWORD get reset to a newly-generated random values
我试图删除所有 docker 容器,但没有成功,不知道我该如何解决这个问题?我没有旧凭据来替换它们。
解决方案
在https://github.com/webyneter的帮助下(django-cookiecutter 的贡献者)
解决方案如下:
- 要查看现有卷:
docker volume ls
- 删除相应的卷
docker volume rm <your project_slug>_postgres_backup_local <your project_slug>_postgres_data_local
推荐阅读
- javascript - How to go to next input by pressing enter in soft keyboard in android web-view phonegap build
- android - Layout_alignParentRight and others aren't working
- java - The system cannot find the path specified: Error while starting zookeeper(Apache Kafka)
- mysql - docker下迁移mysql5/laravel 5报错Specified key was too long
- android - Invoke Flutter (Dart) code from native Android home screen widget
- git - git config --list infinte 来袭
- python-3.x - 如何在此代码中创建字典列表?
- c# - 无法在 C# 中将 GetValueOrDefault() 用于字典
- javascript - 从 mapbox 绘制在这张地图上的数据点的来源和格式是什么?
- mongodb - 在 MongoDb 中,如何获取单个匹配元素的 max\min\avg\count 出现在嵌入式数组中?