要在Ubuntu上使用PgAdmin连接远程服务器,需先配置PostgreSQL允许远程连接,再在PgAdmin中设置连接参数,具体步骤如下:
postgresql.conf文件,将listen_addresses改为'*',允许所有IP连接。pg_hba.conf文件,在末尾添加host all all 0.0.0.0/0 md5,允许所有IP通过密码认证连接。sudo systemctl restart postgresql。sudo ufw allow 5432/tcp。