第一步:输入命令
docker run -d -p 3306:3306 --privileged=true -v /tmp/mysql/log:/var/log/mysql -v /tmp/musql/data:/var/lib/mysql -v /tmp/mysql/conf:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=root --name mysql mysql:5.7
第二步:cd /tmp/mysql/conf
vi my.cnf
[client]
default_character_set=utf8
[mysqld]
collation_server = utf8_general_ci
character_set_server = utf8
第三步:docker restart mysql
docker exec -it mysql bash
show variables like 'character%';