postgresql 连接到本地postgres数据库时出现身份验证错误

llmtgqce  于 2022-11-29  发布在  PostgreSQL
关注(0)|答案(1)|浏览(300)

我目前正在努力连接到本地创建的postgres数据库。postgres服务器是在docker-compose.yml中定义的,如下所示:

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
...

容器似乎开始:

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

现在,当我尝试使用pgadmin和密码“develop”连接到这个数据库时,我得到一个身份验证错误:

配置如下:

有什么明显的错误吗?我可以做什么来进一步调试这个问题?

8ehkhllq

8ehkhllq1#

好吧,我知道了。
有一个正在运行的windows服务也在同一个端口(5432)上打开了一个postgres数据库,所以我试图连接到错误的数据库。
TCPView帮助我解决了这个问题。

相关问题