11
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MySQL Dump (crontab 用見本)

Last updated at Posted at 2014-06-25

バックアップコマンド

DB全体
mysqldump -u root -ppassword -A
# ファイル出力(圧縮コミ)
# | gzip  -c > mysql.all.dump.$(date -I).gz
# | bzip2 -c > mysql.all.dump.$(date -I).bz2
DB単独
mysqldump -u root -ppassword database
DB単独(特定条件を除く)
# 例:申し込み情報を除く
mysqldump -u root -ppassword database -w "order_id IS NULL"
# 例:特定テーブルのデータを除く
mysqldump -u root -ppassword database -w "order.id IS NULL"
DB単独(テーブル構成のみ)
mysqldump -uroot -ppassword database --no-data
DB単独(データのみ)
mysqldump -uroot -ppassword database --no-create-info
DB複数
mysqldump -uroot -ppassword -B database1 database2
DB単独+特定テーブル
mysqldump -uroot -ppassword database table
mysqldump -uroot -ppassword database table1 table2

追加オプション

オプション概要 オプション
Insert 1行単位 --skip-extended-insert
XML 形式で出力 --xml
11
11
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
11
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?