# Mysql5.7
创建映射目录
```shell
# 宿主机创建数据存放目录映射到容器
mkdir -p /usr/local/docker_data/mysql/data
# 宿主机创建配置文件目录映射到容器
mkdir -p /usr/local/docker_data/mysql/conf #(需要在此目录下创建"conf.d"、"mysql.conf.d"两个目录)
mkdir -p /usr/local/docker_data/mysql/conf/conf.d # (建议在此目录创建my.cnf文件并进行相关MySQL配置)
mkdir -p /usr/local/docker_data/mysql/conf/mysql.conf.d
# 宿主机创建日志目录映射到容器
mkdir -p /usr/local/docker_data/mysql/logs
或
mkdir -p data conf logs
mkdir -p conf.d mysql.conf.d
```
```shell
docker run --privileged=true --name mysql5.7 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=Zds@2023 -d -v /root/docker/container/mysql5.7data:/var/lib/mysql -v /root/docker/container/mysql5.7conf:/etc/mysql/conf.d -v /root/docker/container/mysql5.7logs:/var/log/mysql mysql:5.7
```
标签:MySql5.7,mkdir,usr,conf,mysql,docker,data From: https://www.cnblogs.com/byzora/p/17280212.html