用Docker解决坑爹的环境搭建系列——mysql:5.6

sudo docker pull mysql:5.6
mkdir -p /data/docker/mysql/data /data/docker/mysql/logs /data/docker/mysql/conf
sudo docker run -p 33061:3306 --name mysql -v /data/docker/mysql/conf:/etc/mysql -v /data/docker/mysql/logs:/logs -v /data/docker/mysql/data:/usr/data -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6
sudo docker start mysql sudo docker exec -it mysql bash
mysql -u root -p GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '新密码' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '新密码' WITH GRANT OPTION;
flush privileges;
exit cp /usr/my.cnf /etc/mysql/my.cnf
exit sudo nano /data/docker/mysql/conf/my.cnf # 增加内容开始
[client]
default-character-set=utf8 [mysql]
default-character-set=utf8 [mysqld]
character-set-server=utf8
# 结束 sudo docker restart mysql
上一篇:Java Calendar,Date,DateFormat,TimeZone,Locale等时间相关内容的认知和使用(1) Calendar


下一篇:ITFriend创业阶段的server环境搭建手冊