docker-compose.yml
version: "3"
services:
mysql:
image: mysql:5.7
container_name: mysql
hostname: mysql
ports:
- 3306:3306
volumes:
- /home/mysql/data:/var/lib/mysql
- /home/mysql/conf/my.cnf:/etc/my.cnf
- /etc/localtime:/etc/localtime
restart: on-failure
logging:
driver: "json-file"
options:
tag: mysql
cap_add:
- ALL
environment:
MYSQL_ROOT_PASSWORD: 'yourpasswd'
my.cnf
[mysqld]
user=mysql
default-storage-engine=INNODB
character-set-server=utf8
character-set-client-handshake=FALSE
collation-server=utf8_unicode_ci
init_connect='SET NAMES utf8'
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
标签:compose,utf8,character,cnf,set,mysql,docker
From: https://www.cnblogs.com/pgyLang/p/17652400.html