株式会社ヴァンデミックシステム

Blog

<スポンサーリンク>

dumpコマンド

  • dbname = test
mysqldump -uroot -p -h<hostname> -B <dbname> > test.sql

dumpfileの中身

  • データベースが指定される
  20 --
  21 -- GTID state at the beginning of the backup 
  22 --
  23 
  24 SET @@GLOBAL.GTID_PURGED='';
  25 
  26 --
  27 -- Current Database: `test`
  28 --
  29 
  30 CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT 
CHARACTER SET utf8 */;
  31 
  32 USE `test`;
  33 
  34 --

あ、

  • docker-composeで初期データを入れる場合、データベースの指定がないと流し込めないので、こちらのやり方でdumpを取得する必要があるみたいです
  1 db:                                                                                           
  2   image: mysql:latest
  3   volumes:
  4     - ./initdb.d:/docker-entrypoint-initdb.d
  5   environment:
  6     - MYSQL_ROOT_PASSWORD=root

<スポンサーリンク>

コメントを残す

Allowed tags:  you may use these HTML tags and attributes: <a href="">, <strong>, <em>, <h1>, <h2>, <h3>
Please note:  all comments go through moderation.

*

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)