在 Ubuntu 上使用 pgAdmin 添加 PostgreSQL 主机(服务器)的步骤如下:
localhost 或远程 IP)5432)postgres)MyPG)localhost 或服务器 IP5432postgrespostgreshttp://localhost/pgadmin4
PostgreSQL 未启动:
sudo systemctl start postgresql
检查监听地址:
sudo nano /etc/postgresql/*/main/postgresql.conf
确保:
listen_addresses = 'localhost'
或远程访问改为 '*'
修改 pg_hba.conf 允许连接:
host all all 0.0.0.0/0 md5
然后重启:
sudo systemctl restart postgresql
sudo ufw allow 5432
如果你是用 桌面 pgAdmin 还是 Web 版,或者连接的是 本地 / 远程服务器,可以告诉我,我可以给你更具体的配置示例。