Copy database tables to/from different environments

Reasons for copying databases tables to/from different environments:

  • You have multiple applications using independent tables within a single database that you want to deploy as independent environments.
  • You are splitting your application into multiple applications. These applications will each reside in their own environments and each segment of the application addresses its own distinct set of tables.

How to Copy Database Tables

MySQL

mysqldump [dbname] [table1] [table2] ... [tableN] | gzip > /db/migration_tables.sql.gz

PostgreSQL

pg_dump -Fc [dbname] -t [table1] -t [table2] ... -t [tableN] > /db/migration_tables.p

Comments

0 comments

Article is closed for comments.