Windows 他说的文档,我可以使用用户postgres和密码Password12!。我还发现了这讨论,他们说:“我们将在下一个ubuntu图像更新中同时修复pg_hba.conf和密码。”但对我来说还是没用的。我也尝试过没有密码的用户postgres:没有效果,相同的身份验证错误。也许我只是瞎了眼或误解了什么,下面是我的基本AppVeyor配置:
version: 1.0.{build}
skip_tags: true
branches:
only:
- master
image: Ubuntu2004
services:
- postgresql
environment:
PGUSER: postgres
PGPASSWORD: Password12!
build_script:
- echo $PWD $USER $PGUSER $PGPASSWORD
- sudo psql -U postgres -c 'create database my_test_db;'这是我所犯的错误:
Starting 'services'
Starting PostgreSQL
Running "build_script" scripts
echo $PWD $USER $PGUSER $PGPASSWORD
/opt/appveyor/build-agent appveyor postgres Password12!
sudo psql -U postgres -c 'create database my_test_db;'
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "postgres"
Command exited with code 2
Build failed有人能帮帮我吗?
发布于 2022-05-03 08:28:41
我终于找到了解决问题的办法。正如禤浩焯克劳弗在我的帖子下面的评论中建议的那样,我检查了pg_hba.conf文件,发现在图像中,Postgres配置为使用对等认证,实际上我使用了这里的解决方案,并将身份验证方法更改为信任。这种配置非常适合我的需要。下面是最后的appveyor.yml配置:
version: 1.0.{build}
skip_tags: true
branches:
only:
- master
image: Ubuntu2004
services:
- postgresql
environment:
PGUSER: postgres
init:
- sudo sed -i -E -e 's/(local\s+all\s+postgres\s+)peer/\1trust/' /etc/postgresql/14/main/pg_hba.conf
build_script:
- psql -U postgres -c 'create database my_test_db;'https://stackoverflow.com/questions/72075997
复制相似问题