Migrating postgres db within same/different server via cli.
1) Export dump from existing db: pg_dump -U postgres -h <host_address> -p 5432 <db_name> > <dump/backup_file_name>.sql
2) Import dump to new db: psql -h <new_db_host_address> -d <new_db_name> -U postgres -f <dump/backup_file_name>.sql
Note, __In both of the cases you will be prompted with password input.
Top comments (0)