Database Family MySQL: Optimizing Configuration Files

configuration process

1. The file with the suffix .ini in the MySQL file directory is the default configuration file of MySQL.
2. When the program starts, the configuration in the configuration file will be loaded first before the program will actually be started;
3. After changing the settings of the configuration file, it needs to be restarted The server can take effect;

Optimization scheme 1: server memory: 4-8GB

key_buffer_size 384 MB, buffer size for indexing
query_cache_size 192 MB, query cache, please set to 0 if not enabled
tmp_table_size 512 MB, temporary table cache size
innodb_buffer_pool_size 512 MB, Innodb buffer size
innodb_log_buffer_size 128 MB, Innodb log buffer size
sort_buffer_ size 1024 KB * number of connections, buffer size for sorting each thread
read_buffer_size 1024 KB * number of connections, read buffer size
read_rnd_buffer_size 768 KB * number of connections, random read buffer size
join_buffer_size 2048 KB * number of connections, cache size of the association table
thread_stack 256 KB * number of connections, stack size of each thread
binlog_cache_size 128 KB * number of connections, binary log cache size (multiple of 4096)
thread_cache_size 128 thread pool size
table_open_cache 384 table cache
max_connections 300 maximum number of connections

 Optimization scheme 2: server memory: 8-16GB

key_buffer_size 512 MB, buffer size for indexing
query_cache_size 256 MB, query cache, please set to 0 if not enabled
tmp_table_size 1024 MB, temporary table cache size
innodb_buffer_pool_size 1024 MB, Innodb buffer size
innodb_log_buffer_size 128 MB, Innodb log buffer size
sort_buff er_size 2048 KB * number of connections, buffer size for each thread sorting
read_buffer_size 2048 KB * number of connections, read buffer size
read_rnd_buffer_size 1024 KB * number of connections, random read buffer size
join_buffer_size 4096 KB * number of connections, association table cache size
thread_stack 384 KB * number of connections, stack size of each thread
binlog_cache_size 192 KB * number of connections, binary log cache size (multiple of 4096)
thread_cache_size 192 thread pool size
table_open_cache 1024 table cache
max_connections 400 maximum number of connections

 Optimization scheme three: server memory: 16-32GB

 key_buffer_size 1024 MB, buffer size for indexing
query_cache_size 384 MB, query cache, please set to 0 if not enabled
tmp_table_size 2048 MB, temporary table cache size
innodb_buffer_pool_size 4096 MB, Innodb buffer size
innodb_log_buffer_size 128 MB, Innodb log buffer size
sort_b uffer_size 4096 KB * number of connections, buffer size for sorting each thread
read_buffer_size 4096 KB * number of connections, read buffer size
read_rnd_buffer_size 2048 KB * number of connections, random read buffer size
join_buffer_size 8192 KB * number of connections, association table cache size
thread_stack 512 KB * number of connections, stack size of each thread
binlog_cache_size 256 KB * number of connections, binary log cache size (multiple of 4096)
thread_cache_size 256 thread pool size
table_open_cache 2048 table cache
max_connections 500 maximum number of connections

Guess you like

Origin blog.csdn.net/yyongsheng/article/details/131592403