我有一个简单的本地环境,其中包括docker-compose:
version: '3'
services:
postgres-mydb:
image: 'postgres:11-alpine'
ports:
- "5433:5432"
volumes:
- ./pg_data:/var/lib/postgresql
environment:
POSTGRES_DB: docker_mydb_dev
POSTGRES_USER: user
POSTGRES_PASSWORD: password
最近当我尝试连接到数据库时:
psql postgresql://user:password@localhost:5433/docker_mydb_dev
我的理解是:
psql: error: could not connect to server: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
我很困惑,而且在网上也找不到任何有用的想法。