首页 > 代码库 > docke部署mysql

docke部署mysql

#1    docker pull mysql

#2    docker run -v /data/var/mysql/:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=kS4pJUIb mysql

#3    docker stop [CONTAINER ID]

#4    docker run -it -v /data/var/mysql/:/var/lib/mysql mysql /bin/bash

#5    mysqld_safe&

#6    mysql -u root -p

#7    grant all privileges on *.* to ‘wuxiao‘@‘%‘ identified by ‘password‘;

#8    docker cp [CONTAINER ID]:/etc/mysql/my.cnf /data/local/my.cnf

#9    docker stop [CONTAINER ID]

#10    docker run -d -p 3306:3306 -v /data/var/mysql/:/var/lib/mysql -v /data/local/my.cnf:/etc/mysql/my.cnf mysql

#11    add [CMD] to  /etc/rc.local

#12    OK!

docke部署mysql