0.下载
docker pull mysql:5.6
1.创建字符集,防止中文乱码
vim /root/mysql/conf/hmy.conf
[mysqld]
skip-name-resolve
character_set_server=utf8
datadir=/var/lib/mysql
server-id=1000
[mysql]
default-character-set = utf8
[mysql.server]
default-character-set = utf8
[mysqld_safe]
default-character-set = utf8
[client]
default-character-set = utf8
3,docker 创建容器
docker run \
-d \
--name mysql \
-p 3306:3306 \
--privileged=true \
-v /root/mysql/data:/var/lib/mysql \
-v /root/mysql/conf/hmy.conf:/etc/mysql/conf.d/hmy.cnf \
-e MYSQL_ROOT_PASSWORD=123456 \
mysql:5.6