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.
mysqlmysql docker-compose
https://www.docker.com/products/docker-desktop
No need to install mysql client
.
When connect-xxx.sh execute, the mysql client installed in the docker container is executed locally
.
MySQL
connect-xxx.shMySQLmysql
git clone [email protected]:treetips/docker-compose-all-mysql.git
$ docker-compose up -d
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
Wait for MySQL started before connecting.
MySQL
vi ./my.cnf
All the same connection setting except port.
$ 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
If you change database-schema or user or password or root-password, Edit .env
.
DBroot .env
DB_DATABASE=work
DB_USER=worker
DB_PASSWORD=worker
DB_ROOT_PASSWORD=root
If you want to delete general.log
and error.log
and slow-query.log
, execute clear_logs.sh
.
general.log
error.log
clear_logs.sh
https://hub.docker.com/_/mysql/#initializing-a-fresh-instance
./common/initdb.d/common-init.(sh|sql)
(executed commonly for all containers)./(mysql|mariadb)X.X/initdb.d/xxx.(sh|sql)
(executed for each container)Initial data can be input at startup by customizing these.