Skip to content
MySQL and MariaDB docker containers of MySQL v5.5, v5.6, v5.7, v8.0, mariadb v10.0, v10.1, v10.2, v10.3
Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
common/initdb.d fix: remove alt text of image tag May 25, 2019
mariadb10.0 feat: add init sql and shell-scripts at startup Feb 17, 2019
mariadb10.1 feat: add init sql and shell-scripts at startup Feb 17, 2019
mariadb10.2 feat: add init sql and shell-scripts at startup Feb 17, 2019
mariadb10.3 feat: add init sql and shell-scripts at startup Feb 17, 2019
mysql5.5
mysql5.6 feat: add init sql and shell-scripts at startup Feb 17, 2019
mysql5.7 feat: add init sql and shell-scripts at startup Feb 17, 2019
mysql8.0 feat: add init sql and shell-scripts at startup Feb 17, 2019
.editorconfig feat: add edit config Feb 17, 2019
.gitignore refactor: add log directory Feb 17, 2019
README.md docs: refresh readme Feb 17, 2019
clear_logs.sh refactor: add log directory Feb 17, 2019
connect-mariadb-10-0.sh
connect-mariadb-10-1.sh fix: version number of the file name even with a hyphen Jul 31, 2018
connect-mariadb-10-2.sh fix: version number of the file name even with a hyphen Jul 31, 2018
connect-mariadb-10-3.sh fix: version number of the file name even with a hyphen Jul 31, 2018
connect-mysql-5-5.sh refactor: move connection settings to my.cnf Apr 20, 2018
connect-mysql-5-6.sh refactor: move connection settings to my.cnf Apr 20, 2018
connect-mysql-5-7.sh
connect-mysql-8-0.sh
docker-compose.yml feat: add init sql and shell-scripts at startup Feb 17, 2019
my.cnf

README.md

Create all mysql-server docker container.

Motivation

In order to make it easy to test whether applications can be started with different versions, such as upgrading mysql, we made it possible to start multiple mysql servers easily.

Support MySQL version.

  • MySQL v5.5
  • MySQL v5.6
  • MySQL v5.7
  • MySQL v8.0
  • mariadb v10.0
  • mariadb v10.1
  • mariadb v10.2
  • mariadb v10.3

Usage

Install docker desktop

https://www.docker.com/products/docker-desktop

Install mysql-client

Install mysql client only for Mac OSX.

$ brew upgrade
$ brew install mysql --client-only

It is not necessary to install mysql-server.

Clone this repository

git clone git@github.com:treetips/docker-compose-all-mysql.git

Start mysql docker containers

$ docker-compose up -d

Connect any mysql-server on docker container

Connect remote mysql servers.

$ ./connect-mysql-5-5.sh
$ ./connect-mysql-5-6.sh
$ ./connect-mysql-5-6.sh
$ ./connect-mysql-8-0.sh
$ ./connect-mariadb-10-0.sh
$ ./connect-mariadb-10-1.sh
$ ./connect-mariadb-10-2.sh
$ ./connect-mariadb-10-3.sh

Optional

Customize mysql client settings

vi ./my.cnf

All the same connection setting except port.

Customize mysql server settings

$ vi ./mysql5.5/conf.d/my.cnf
$ vi ./mysql5.6/conf.d/my.cnf
$ vi ./mysql5.7/conf.d/my.cnf
$ vi ./mysql8.0/conf.d/my.cnf
$ vi ./mariadb10.0/conf.d/my.cnf
$ vi ./mariadb10.1/conf.d/my.cnf
$ vi ./mariadb10.2/conf.d/my.cnf
$ vi ./mariadb10.3/conf.d/my.cnf

Customize default schema, user, password

If you change database-schema or user or password or root-password, Edit docker-compose.yml.

- MYSQL_DATABASE=work
- MYSQL_USER=worker
- MYSQL_PASSWORD=worker
- MYSQL_ROOT_PASSWORD=root

Remove logs

If you want to delete general.log and error.log and slow-query.log, execute clear_logs.sh .

Customize init scripts

https://hub.docker.com/_/mysql/#initializing-a-fresh-instance

Execution order at startup

  1. ./common/initdb.d/common-init.(sh|sql) (executed commonly for all containers)
  2. ./(mysql|mariadb)X.X/initdb.d/xxx.(sh|sql) (executed for each container)

Initial data can be input at startup by customizing these.

You can’t perform that action at this time.