创建配置文件
[mysqld] pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = /var/lib/mysql log-error = /var/log/mysql/error.log symbolic-links = 0 default-time-zone = '+8:00' log_timestamps = system character-set-server= utf8mb4 collation-server = utf8mb4_unicode_ci log-bin = mysql-bin binlog_format = ROW max_binlog_size = 100M expire_logs_days = 0 server_id = 11
启动
docker run --rm --name some-mysql \ -v /etc/localtime:/etc/localtime:ro \ -v /root/mysql/conf:/etc/mysql/mysql.conf.d \ -v /root/mysql/data:/var/lib/mysql \ -p 3306:3306 \ -e MYSQL_ROOT_PASSWORD=my-secret-pw \ -e TZ=Asia/Shanghai \ -d mysql:5.7.36