简体   繁体   中英

Authentication error when connection to local postgres db

I am currently struggling to connect to a locally created postgres db. The postgres server is defined inside a docker-compose.yml like this:

version: '3.9'
services:
    postgres:
        image: bitnami/postgresql:13.4.0
        container_name: mopla-postgres
        restart: always
        environment:
            - POSTGRES_USER=mopla
            - POSTGRES_PASSWORD=develop
            - POSTGRESQL_DATABASE=mopla
        volumes:
            - mopla-postgres:/bitnami/postgresql
            - ./database_dumps:/docker-entrypoint-initdb.d
        ports:
            - 5432:5432
...

The container seems to start:

postgresql 09:02:41.34 
postgresql 09:02:41.34 Welcome to the Bitnami postgresql container
postgresql 09:02:41.34 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
postgresql 09:02:41.34 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues
postgresql 09:02:41.35 
postgresql 09:02:41.36 INFO  ==> ** Starting PostgreSQL setup **
postgresql 09:02:41.39 INFO  ==> Validating settings in POSTGRESQL_* env vars..
postgresql 09:02:41.39 INFO  ==> Loading custom pre-init scripts...
postgresql 09:02:41.40 INFO  ==> Initializing PostgreSQL database...
postgresql 09:02:41.42 INFO  ==> pg_hba.conf file not detected. Generating it...
postgresql 09:02:41.42 INFO  ==> Generating local authentication configuration
postgresql 09:02:41.43 INFO  ==> Deploying PostgreSQL with persisted data...
postgresql 09:02:41.43 INFO  ==> Configuring replication parameters
postgresql 09:02:41.46 INFO  ==> Configuring fsync
postgresql 09:02:41.49 INFO  ==> Loading custom scripts...
postgresql 09:02:41.50 INFO  ==> Enabling remote connections
postgresql 09:02:41.51 INFO  ==> ** PostgreSQL setup finished! **
postgresql 09:02:41.55 INFO  ==> ** Starting PostgreSQL **
2022-11-28 09:02:41.571 GMT [1] LOG:  pgaudit extension initialized
2022-11-28 09:02:41.576 GMT [1] LOG:  starting PostgreSQL 13.4 on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2022-11-28 09:02:41.576 GMT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2022-11-28 09:02:41.576 GMT [1] LOG:  listening on IPv6 address "::", port 5432
2022-11-28 09:02:41.580 GMT [1] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2022-11-28 09:02:41.586 GMT [85] LOG:  database system was shut down at 2022-11-28 09:02:36 GMT
2022-11-28 09:02:41.590 GMT [1] LOG:  database system is ready to accept connections

Now, when I try to connect to this database with pgadmin with the password "develop", I get an authentication error:

在此处输入图像描述

Here is the configuration:

在此处输入图像描述

Is there anything obvious I am doing wrong? Anything I can do to debug this issue further?

Alright, I figured it out.

There was a windows-service running that was also opening a postgres db on the same port (5432), so I was trying to connect to the wrong db.

TCPView helped me figuring out the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM