Skip to content

Instantly share code, notes, and snippets.

@xingstarx
Created August 13, 2018 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xingstarx/103a9e41b24f3ea94a1e63469382d186 to your computer and use it in GitHub Desktop.
Save xingstarx/103a9e41b24f3ea94a1e63469382d186 to your computer and use it in GitHub Desktop.
docker下启动MySQL,解决内存占用过大的问题
[mysqld]
# /etc/my.cnf
performance_schema = 0
innodb_buffer_pool_size=5M
innodb_log_buffer_size=256K
query_cache_size=0
max_connections=10
key_buffer_size=8
thread_cache_size=0
host_cache_size=0
innodb_ft_cache_size=1600000
innodb_ft_total_cache_size=32000000
# per thread or per operation settings
thread_stack=131072
sort_buffer_size=32K
read_buffer_size=8200
read_rnd_buffer_size=8200
max_heap_table_size=16K
tmp_table_size=1K
bulk_insert_buffer_size=0
join_buffer_size=128
net_buffer_length=1K
innodb_sort_buffer_size=64K
#settings that relate to the binary log (if enabled)
binlog_cache_size=4K
binlog_stmt_cache_size=4K
@xingstarx
Copy link
Author

docker 的yaml文件内容为

mysql:
  image: daocloud.io/library/mysql:5.6.29
  privileged: false
  restart: always
  ports:
  - 3306:3306
  volumes:
  - /root/custom-mysql-config.cnf:/etc/mysql/conf.d/custom-mysql-config.cnf
  - /root/mysql_data:/var/lib/mysql
  environment:
  - MYSQL_ROOT_PASSWORD=my-password

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment