docker cp mysql:/etc/mysql/mysql.conf.d/mysqld.cnf /home/mysql/conf
mv mysqld.cnf my.cnf
#!/bin/bash
docker stop MySQL
docker rm -f mysql
docker run --privileged=true \
-idt \
-p 3307:3306 \
--name mysql \
--restart=always \
-v /home/mysql/data:/var/lib/mysql \
-v /home/mysql/conf/my.cnf:/etc/mysql/my.cnf \
-e TZ='Asia/Shanghai' \
-e MYSQL_ROOT_PASSWORD=xxxxxxx \
-e MYSQL_USER=redmine \
-e MYSQL_PASSWORD=xxxxxxx \
-e MYSQL_DATABASE=redmine_production \
mysql:5.7.27
sleep 3s
docker logs mysql
CREATE USER 'redmine'@'%' IDENTIFIED BY 'xxxxxx';
CREATE DATABASE IF NOT EXISTS `redmine_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_general_ci`;
GRANT ALL PRIVILEGES ON *.* TO 'redmine'@'%';
flush privileges;