From 533c8fc7f7a4340fd6e30d1b8b7400b6e119aab3 Mon Sep 17 00:00:00 2001 From: Shao Yu Lung Date: Mon, 8 May 2017 22:26:10 +0800 Subject: [PATCH] mysql create multiple database. --- docker-compose.yml | 1 + mysql/docker-entrypoint-initdb.d/.gitignore | 1 + mysql/docker-entrypoint-initdb.d/createdb.sql.example | 8 ++++++++ 3 files changed, 10 insertions(+) create mode 100644 mysql/docker-entrypoint-initdb.d/.gitignore create mode 100644 mysql/docker-entrypoint-initdb.d/createdb.sql.example diff --git a/docker-compose.yml b/docker-compose.yml index 0f0582e..7cca302 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -194,6 +194,7 @@ services: - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} volumes: - ${DATA_SAVE_PATH}/mysql:/var/lib/mysql + - ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d ports: - "${MYSQL_PORT}:3306" networks: diff --git a/mysql/docker-entrypoint-initdb.d/.gitignore b/mysql/docker-entrypoint-initdb.d/.gitignore new file mode 100644 index 0000000..d1b811b --- /dev/null +++ b/mysql/docker-entrypoint-initdb.d/.gitignore @@ -0,0 +1 @@ +*.sql diff --git a/mysql/docker-entrypoint-initdb.d/createdb.sql.example b/mysql/docker-entrypoint-initdb.d/createdb.sql.example new file mode 100644 index 0000000..07b277e --- /dev/null +++ b/mysql/docker-entrypoint-initdb.d/createdb.sql.example @@ -0,0 +1,8 @@ +### +### Copy createdb.sql.example to createdb.sql +### then uncomment and set database name to create you need databases +### + +#CREATE DATABASE IF NOT EXISTS `dev_db_1` ; +#CREATE DATABASE IF NOT EXISTS `dev_db_2` ; +#CREATE DATABASE IF NOT EXISTS `dev_db_3` ;