创建两个目录
/data/mysql/config
/data/mysql/store
新建文件/data/mysql/config/mysql.cnf,内容为:
[mysqld]
symbolic-links=0
max_connections=3000
max_user_connections=500
wait_timeout=200
character-set-server=utf8mb4
collation-server=utf8mb4_bin
default-time_zone='+8:00'
[mysql]
default-character-set=utf8mb4
[client]
default-character-set=utf8mb4
启动命令
docker run \
-itd \
--publish 3306:3306 \
-e MYSQL_ROOT_HOST=% \
-e MYSQL_ROOT_PASSWORD=mysqlpassword \
--name mysql \
--restart always \
--privileged=true \
-v /data/mysql/store:/var/lib/mysql \
-v /data/mysql/conf/mysql.cnf:/etc/mysql/conf.d/mysql.cnf \
mysql:5.7.23