DEV Community

Sandip Basnet
Sandip Basnet

Posted on

1

Migrating postgres db from CLI

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)

Image of DataStax

AI Agents Made Easy with Langflow

Connect models, vector stores, memory and other AI building blocks with the click of a button to build and deploy AI-powered agents.

Get started for free