yum -y install docker docker pull centos docker run --name=mysqltmp -i -t centos /bin/bash yum -y install wget wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm yum -y install mysql-community-server mysql-community-devel /usr/bin/mysql_install_db --user=mysql cp -R /etc/my.cnf /var/lib/mysql/my.cnf vi /var/lib/mysql/my.cnf log-error=/var/lib/mysql/mysqld.log /usr/bin/mysqld_safe --defaults-file=/var/lib/mysql/my.cnf& /usr/bin/mysql -e "grant all privileges on *.* to 'root'@'%' identified by 'X7898700';" /usr/bin/mysql -e "grant all privileges on *.* to 'root'@'localhost' identified by 'X7898700';" /usr/bin/mysql -u root -pX7898700 -e "show databases;" exit docker commit mysqltmp mysql/mysql56 docker stop mysqltmp docker rm mysqltmp
docker run --name=mysqltmp -t -i -d mysql/mysql56 /usr/bin/mysqld_safe --defaults-file=/var/lib/mysql/my.cnf mkdir /home/mysql/data3307/ docker cp mysqltmp:/var/lib/mysql /home/mysql/data3307 docker stop mysqltmp docker rm mysqltmp chown mysql:mysql /home/mysql/data3307/ -R docker run --name=mysqlserver3307 -t -i -d -p 3307:3306 -v /home/mysql/data3307/:/var/lib/mysql/ mysql/mysql56 /usr/bin/mysqld_safe --defaults-file=/var/lib/mysql/my.cnf docker start mysqlserver3307 >> /home/logs/mysql3307.log
docker run --name=mysqltmp -t -i -d mysql/mysql56 /usr/bin/mysqld_safe --defaults-file=/var/lib/mysql/my.cnf mkdir /home/mysql/data3308 docker cp mysqltmp:/var/lib/mysql /home/mysql/data3308 docker stop mysqltmp docker rm mysqltmp chown mysql:mysql /home/mysql/data3308/ -R docker run --name=mysqlserver3308 -t -i -d -p 3308:3306 -v /home/mysql/data3308/:/var/lib/mysql/ mysql/mysql56 /usr/bin/mysqld_safe --defaults-file=/var/lib/mysql/my.cnf docker start mysqlserver3308 >> /home/logs/mysql3308.log