1、安装mysql
2、启动mysql
说明: -v /usr/local/mysql/conf:/etc/mysql/mysql.conf.d
:前面/usr/local/mysql/conf为本地物理机需要挂载的目录
:后面/etc/mysql/mysql.conf.d为挂载到docker容器中的路径
docker run -p 3315:3306 --name mysql5.7 \ -v /usr/local/mysql/conf:/etc/mysql/mysql.conf.d \ -v /usr/local/mysql/log:/var/log/ \ -v /usr/local/mysql/data:/var/lib/mysql \ -e MYSQL_ROOT_PASSWORD=Pgpw2023#* \ -d mysql:5.7