在Ubuntu上迁移pgAdmin可分为版本升级迁移和数据迁移,具体步骤如下:
备份配置与数据
cp -r ~/.pgadmin /path/to/backup/
。pg_dump
导出需迁移的数据库为SQL文件。卸载旧版本
sudo apt remove pgadmin4
安装新版本
sudo apt update
sudo apt install pgadmin4
sudo dpkg -i pgadmin4_x.x.x.deb
sudo apt-get install -f
恢复配置与数据
cp -r /path/to/backup/.pgadmin ~/.pgadmin
。pg_restore
恢复备份文件。验证
导出数据(源服务器)
pg_dump
导出为SQL文件:pg_dump -U username -h source_host -d dbname > dbname.sql
传输文件
scp
或rsync
复制到目标服务器:scp dbname.sql user@target_host:/path/to/destination/
导入数据(目标服务器)
psql
或pgAdmin导入:psql -U username -h target_host -d dbname < dbname.sql
pg_roles
等系统表(谨慎操作)。参考来源: