我正在使用postgres:14-alpine image在 Docker 上设置本地 Postgres 数据库,并使用golang-migrate在其上运行数据库迁移,当我在运行该migrate
工具后收到以下错误消息时:
error: pq: role "root" does not exist
我正在运行以下命令:
$ docker run --name postgres14 -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=pass -d postgres:14-alpine $ docker exec -it postgres14 createdb --user=root --owner=root demodb $ migrate -path db/migrations -database postgresql://root:pass@localhost:5432/demodb?sslmode=disable --verbose up
也可以在这个 Makefile中查看这些命令,并且可以在这个存储库中找到完整的代码库。
以下是来自 Postgres 容器的日志:
The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale "en_US.utf8". The default database encoding has accordingly been set to "UTF8". The default text search configuration will be set to "english". Data page checksums are disabled.
我应该怎么做才能root
正确配置角色?
白猪掌柜的
慕丝7291255
相关分类