LoginSignup
1
1

More than 5 years have passed since last update.

ローカル環境用に本番dbのスキーマとデータをdumpする。

Last updated at Posted at 2013-10-22

概要

ローカルには本番のデータ全てが必要な訳ではないため、
・全テーブルのschema
・一部テーブルのデータ
が必要になる。

全テーブルのschemaをdump

-dでschemaをdumpできる。

mysqldump -u user_name -pxxxx -h host_num -d db_name > schema_dump.sql

一部テーブルのデータをdump

db_nameのあとにtable_nameを続けるだけ。

mysqldump -u user_name -pxxxx -h host_num db_name \
tableA  \
tableB  \
tableC  \
> data_dump.sql

あとはローカルdbにschema.dumpとdata.dumpを流せばok。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1