1、拉取镜像
docker pull mysql
2、运行镜像
docker run -d --restart=always --name mysql --privileged=true -p 3306:3306 -v /home/sunyuhua/docker/mysql/data:/var/lib/mysql -v /home/sunyuhua/docker/mysql/conf:/etc/mysql/conf.d -v /home/sunyuhua/docker/mysql/logs:/logs -e MYSQL_ROOT_PASSWORD=root -e TZ=Asia/Shanghai mysql --lower_case_table_names=1
3、进入mysql镜像,设置权限
docker exec -it mysql /bin/bash
mysql -uroot -p
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
flush privileges;