命令 总结
yum install docker-compose-plugindocker compose versiondocker compose updocker compose up -d
相关的配置。
创建docker-conpose 目录,并创建docker-compose.yml文件
version: '3'
services:
mysql:
image: mysql
restart: always
container_name: mysql
environment:
MYSQL_ROOT_PASSWORD: 123456
TZ: Asia/Shanghai
ports:
- 3306:3306
volumes:
- /home/mysql/data:/var/lib/mysql
- /home/mysql/config/my.cnf:/etc/mysql/my.cnf
command:
--max_connections=1000
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--default-authentication-plugin=mysql_native_password
创建配置文件 my.conf
[mysqld]
user=mysql
default-storage-engine=INNODB
character-set-server=utf8
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
执行命令启动。
验证连接
参考资料
Docker -compose 安装mysql
docker安装mysql