小内存 linux 主机部署 mysql
安装docker
安装docker-compose
获取最新镜像
-
mysql:latest
-
编写 docker-compose.yaml
version: '3.2'
services:
mysql:
restart: unless-stopped
image: mysql:latest
container_name: mysql
volumes:
- ./datadir:/var/lib/mysql
- ./conf/docker.cnf:/etc/mysql/conf.d/docker.cnf
environment:
- "MYSQL_ROOT_PASSWORD=123456mysql"
ports:
- 3306:3306
- 编写配置文件 ./conf/docker.cnf
[mysqld]
performance_schema_max_table_instances=400
table_definition_cache=400
table_open_cache=256
performance_schema = off
skip-host-cache
skip-name-resolve
- docker-compose up -d 完成!
内存占用不到 100m