LoginSignup
0

More than 3 years have passed since last update.

MySQLのデータをダンプしてコンテナ上のMySQLにデータを取り込む方法

Posted at

似たようなことを何回も調べてる気がするのでめも :pencil:

ダンプする

mysqldump -u [ユーザー名] -p -h [ホスト名] [DB名] >> dump.sql

Dockerコンテナ上のmysqlにダンプファイルを読み込む

$ docker cp dump.sql sample_mysqldb_1:/tmp/
$ docker exec -it sample_mysqldb_1 sh
# mysql -u[ユーザー名] -p[パスワード] -h[ホスト名] [DB名] < /tmp/dump.sql

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