Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
11
Help us understand the problem. What is going on with this article?
@asahina_dev

MySQL Dump (crontab 用見本)

More than 5 years have passed since last update.

バックアップコマンド

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
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
11
Help us understand the problem. What is going on with this article?