MySQL 的容器化部署与数据库初始化
01 概述 1.1 环境 CentOS 8 $ docker --version Docker version 20.10.11, build dea9396 $ docker-compose --version Docker Compose version v2.16.0 1.2 Docker 安装 MySQL 的初始化原理 MySQL Docker 官方介绍:Initializing a refsh instance When a container is started for the first time, a new database with the specified name will be created and initialized with the provided configuration variables. Furthermore, it will execute files with extensions ++.sh, .sql and .sql.gz++ that are found in /docker-entrypoint-initdb.d. Files will be executed in alphabetical order. You can easily populate your mysql services by mounting a SQL dump into that directory and provide custom images with contributed data. SQL files will be imported by default to the database specified by the MYSQL_DATABASE variable. ...