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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please show some love ❤️ or share a kind word in the comments if you found this useful!

Got it!