You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法通过PgAdmin连接本地PostgreSQL问题求助

无法通过PgAdmin连接本地PostgreSQL(终端连接正常)

问题描述

  • 已完成Ubuntu官方文档中的PostgreSQL配置,终端执行以下命令可成功连接数据库:
    psql --host localhost --username <user_name> --password -p 5433 --dbname <db_name>
    
    终端输出如下:
    psql (14.9 (Ubuntu 14.9-0ubuntu0.22.04.1))
    SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
    Type "help" for help.
    
  • 但通过PgAdmin界面连接时出现错误,错误截图如下:
    PgAdmin连接错误截图

系统与版本信息

  • Ubuntu系统版本:
    Linux d 5.19.0-50-generic #50-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 10 18:24:29 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
    
  • psql版本:
    psql (PostgreSQL) 14.9 (Ubuntu 14.9-0ubuntu0.22.04.1)
    

当前postgresql.conf配置内容

data_directory = '/var/lib/postgresql/14/main'      
hba_file = '/etc/postgresql/14/main/pg_hba.conf'    
ident_file = '/etc/postgresql/14/main/pg_ident.conf'    
external_pid_file = '/var/run/postgresql/14-main.pid'           
listen_addresses = '*'      
port = 5433              
max_connections = 100           
unix_socket_directories = '/var/run/postgresql' 
ssl = on
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key'
shared_buffers = 128MB          
dynamic_shared_memory_type = posix  
max_wal_size = 1GB
min_wal_size = 80MB
log_line_prefix = '%m [%p] %q%u@%d '        
cluster_name = '14/main'            
stats_temp_directory = '/var/run/postgresql/14-main.pg_stat_tmp'
datestyle = 'iso, mdy'
lc_messages = 'en_US.UTF-8'         
default_text_search_config = 'pg_catalog.english'
include_dir = 'conf.d'          

已尝试的解决方法

曾尝试过某Stack Overflow上的解决方案,但该方法无效且安全性较低。


内容的提问来源于stack exchange,提问作者littleNicky

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 20:47:01