windows 下my.ini的配置优化

线上有若干WIN环境下的MySQL,需要进行优化配置,列出以下参数方便查阅

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....

basedir = D:\MySQL5.6
datadir = D:MySQL5.6\data
max_connections = 1100
max_user_connections = 1000
max_connect_errors = 10000
max_allowed_packet = 128M

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

skip_name_resolve = 1
skip_external_locking = 1 
lower_case_table_names = 1
# logs
long_query_time    = 1
slow_query_log = 1
slow_query_log_file = D:\MySQL5.6\logs\slow.log   
log_error = D:\MySQL5.6\logs\error.log   
#innodb_force_recovery=1
# binlog
binlog_format = row
log_bin     = D:\MySQL5.6\logs\mysql-bin  
binlog_cache_size = 8M
max_binlog_size = 1G
max_binlog_cache_size = 4G
expire_logs_days = 5
log_bin_trust_function_creators = 1

############ myisam
key_buffer_size = 64M
#bulk_insert_buffer_size = 32M
########## PGA
sort_buffer_size = 8M
read_buffer_size = 8M
join_buffer_size = 32M
read_rnd_buffer_size = 32M
query_cache_type = 0
query_cache_size = 0M
table_open_cache = 6144
table_definition_cache = 4096
open_files_limit = 65536
back_log = 512


thread_cache_size = 64
thread_stack=192k
tmp_table_size=128M
max_heap_table_size=128M


transaction_isolation = READ-COMMITTED
innodb_data_home_dir = D:MySQL5.6\data    
innodb_log_group_home_dir = D:MySQL5.6\data
innodb_data_file_path = ibdata1:12M:autoextend
innodb_buffer_pool_size = 1G
innodb_buffer_pool_instances    = 8
innodb_log_file_size = 1024M
innodb_log_buffer_size = 64M
innodb_log_files_in_group = 3
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 10
innodb_sync_spin_loops = 40
innodb_max_dirty_pages_pct = 80
innodb_thread_concurrency = 0
innodb_thread_sleep_delay = 500
innodb_concurrency_tickets = 1000
innodb_file_per_table = 1
innodb_read_io_threads = 20
innodb_write_io_threads = 20
innodb_io_capacity = 600
innodb_file_format = Barracuda
innodb_purge_threads=1
innodb_purge_batch_size = 32
innodb_old_blocks_pct=50
innodb_stats_on_metadata=0

optimizer_switch='mrr=on,mrr_cost_based=off,batched_key_access=on'


[myisamchk]
key_buffer_size = 64M
sort_buffer_size = 512k
read_buffer = 2M
write_buffer = 2M


[mysqldump]
quick
max_allowed_packet = 128M
#myisam_max_sort_file_size = 10G


[mysql]
no-auto-rehash
max_allowed_packet = 128M
prompt                         = '(BI154)u@h [10.11.20.31]> '
原文地址:https://www.cnblogs.com/olinux/p/5606271.html