一、拉取mysql8.0数据库镜像
docker pull mysql:8.0
二、创建配置、数据、日志挂载目录
mkdir -p /data/mysql/conf
mkdir -p /data/mysql/data
mkdir -p /data/mysql/logs
三、新建my.cnf配置文件
1、进入配置文件夹
cd /data/mysql/conf
2、新建my.cnf文件
vi my.cnf
3、添加配置信息
[client]
port = 3360
default-character-set = utf8mb4
[mysql]
port = 3308
default-character-set = utf8mb4
[mysqld]
# bind-address = 0.0.0.0
# port = 3306
max_connections=10000
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
# 设置时区和字符集
# default-time-zone='+8:00'
character-set-client-handshake=FALSE
init_connect='SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci'
gtid-mode=ON
enforce-gtid-consistency = ON
四、启动mysql8.0镜像
1、启动命令
docker run
--restart=always \
--name mysql8.0 \
-p 3360:3306 \
-v /data/mysql/conf:/etc/mysql \
-v /data/mysql/data:/var/lib/mysql \
-v /data/mysql/log:/var/log \
-d mysql8.0 \
-e MYSQL_ROOT_PASSWORD='123456' \
--lower_case_table_names=1
标签:set,utf8mb4,mysql8,data,character,部署,mysql8.0,mysql,安装
From: https://blog.csdn.net/u014391549/article/details/140927861