LoginSignup
1

More than 5 years have passed since last update.

mysql バックアップ/復元(エクスポート/インポート)

Last updated at Posted at 2018-04-10

csv エクスポート

mysqldump -u root -p -t {database} > backup_db.sql

csvをテーブルごとに分割

csplit backup_db.sql '/DROP TABLE IF EXISTS/' {*}

復元したいテーブルのcsv検索

grep -il 'create table{database}' ./xx*

テーブル復元

mysql -u root -p {database} < xx0N;

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