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