LoginSignup
0
2

More than 5 years have passed since last update.

仮想環境(vagrant + virtualbox)にあるmariadbにダンプファイルをインポートする

Last updated at Posted at 2017-04-09

MariaDBにダンプファイルをインポートする

1.仮想環境にダンプファイルを送る

まずは仮想環境にファイルを送ります。

1-1.MACユーザだったら、、、

VagrantのSSHの設定ファイルを書き出す
$ vagrant ssh-config > ssh.config

書き出した設定ファイルを使って転送する
$ scp -F ssh.config dump.sql vagrant@default:~/
こんなかんじですかね!

1-2.Winだったら、

WinSCPとかでDragAndDropしちゃう^^

2.sourceコマンドでダンプを入れる

mysql -u ユーザ名 -p
パスワード

EX)
mysql -u root -p
root

ログインできたら、、、

use DB名
Ex)↓
use test_db

Database changed←と出力される
source ダンプファイルを置いたパス
EX)↓
source /home/vagrant/dump.sql

以上となります!
お疲れ様でした!

0
2
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
0
2