使用CircleCI在Postgresql中添加其他数据库
我的CircleCI构建有问题,我希望有人能帮我解决 我正在使用使用CircleCI在Postgresql中添加其他数据库,postgresql,circleci,circleci-2.0,circleci-workflows,Postgresql,Circleci,Circleci 2.0,Circleci Workflows,我的CircleCI构建有问题,我希望有人能帮我解决 我正在使用circleci/postgres图像,并为其提供postgres\u用户、postgres\u数据库和postgres\u密码环境值 - image: circleci/postgres:11.7 environment: POSTGRES_USER: postgres POSTGRES_DB: main POSTGRES_PASSWORD: secret 在我运行一些测试之后,我想创建一些额外的数据
circleci/postgres
图像,并为其提供postgres\u用户
、postgres\u数据库
和postgres\u密码
环境值
- image: circleci/postgres:11.7
environment:
POSTGRES_USER: postgres
POSTGRES_DB: main
POSTGRES_PASSWORD: secret
在我运行一些测试之后,我想创建一些额外的数据库,我就是这样做的
- run:
name: "Creating Account Databases"
command: |
apk add postgresql-client
createdb -h localhost temporary -O postgres
createdb -h localhost temporaryother -O postgres
问题是当circle ci运行它时,我得到以下错误:
createdb: could not connect to database template1: FATAL: role "root" does not exist
Exited with code exit status 1
CircleCI received exit code 1
我不确定如何解决这个问题,我没有在任何地方定义根角色,所以我不确定发生了什么
任何帮助都将不胜感激。默认情况下,当您尝试创建时,当前用户将被视为数据库用户。您可能需要指定-U postgres来创建,但这可能需要密码。另一种方法是使用命令-sudo su postgres切换到用户postgres并执行createdb。默认情况下,当您尝试创建时,当前用户将作为数据库用户。您可能需要指定-U postgres来创建,但这可能需要密码。另一种方法是使用命令-sudosupostgres切换到用户postgres并执行createdb。