1.Docker 中修改 docker-compose.yaml
version: '3'
services:
mysql:
container_name: mysql5.7
image: mysql:5.7.33
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: "123456"
MYSQL_USER: 'user'
MYSQL_PASS: 'user123456'
restart: always
volumes:
- "./db:/var/lib/mysql"
- "./conf/my.cnf:/etc/my.cnf"
- "./init:/docker-entrypoint-initdb.d/"
deploy:
resources:
limits:
cpus: '0.4'
memory: 200M
# reservations:
#cpus: '0.2'
#memory: 200M
2. 同目录下 conf 中的 mysql 的 my.conf 中修改配置
[client]
default-character-set=utf8
#character-set-server=utf8
#mysqlde utf8字符集默认为3位的,不支持emoji表情及部分不常见的汉字,故推荐使用utf8mb4
[mysql]
default-character-set=utf8
#character-set-server=utf8
[mysqld]
#character-set-server=utf8
performance_schema=off #效果明显
table_open_cache=64
performance_schema_max_table_instances=400
innodb_buffer_pool_chunk_size=64M
innodb_buffer_pool_size=64M
query_cache_size=16M
tmp_table_size=18M
key_buffer_size=32m
#skip-grant-tables
来源:?vuqx – welcom to my vuqx.com
|