天天看點

MySQL 參數整理

[client]                           
socket                             = /testdb/my3332/var/mysql.sock
port                               = 3332
[mysqld]

############# GENERAL #############
autocommit                         = ON
character_set_server               = UTF8MB4
collation_server                   = UTF8MB4_BIN
explicit_defaults_for_timestamp    = ON  
lower_case_table_names             = 1
port                               = 3332
read_only                          = ON
transaction_isolation              = READ-COMMITTED

####### CACHES AND LIMITS #########
interactive_timeout                = 600
lock_wait_timeout                  = 50
max_allowed_packet                 = 32M
max_connect_errors                 = 10000
max_connections                    = 800
max_user_connections               = 400
sort_buffer_size                   = 1M
table_definition_cache             = 1400
table_open_cache                   = 5000 
table_open_cache_instances         = 4
thread_cache_size                  = 9
thread_stack                       = 256K
tmp_table_size                     = 32M

############# SAFETY ##############
local_infile                       = OFF
plugin-load                        = validate_password.so
skip_name_resolve                  = ON
sql_mode                           = STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,ONLY_FULL_GROUP_BY

############# LOGGING #############
general_log                        = 0
log_queries_not_using_indexes      = ON
log_slow_admin_statements          = ON
log_warnings                       = 2
long_query_time                    = 1
slow_query_log                     = ON

############# REPLICATION #############
binlog_checksum                    = CRC32
binlog_format                      = ROW
binlog_rows_query_log_events       = ON
enforce_gtid_consistency           = ON
expire_logs_days                   = 7
gtid_mode                          = ON
log_slave_updates                  = ON
master_info_repository             = TABLE
master_verify_checksum             = ON
max_binlog_size                    = 256M
relay_log_info_repository          = TABLE
server_id                          = 4061333332
skip_slave_start                   = ON
slave_net_timeout                  = 4
slave_sql_verify_checksum          = ON
sync_binlog                        = 1
sync_master_info                   = 10000
sync_relay_log                     = 10000
sync_relay_log_info                = 10000
rpl_semi_sync_master_enabled       = 1
rpl_semi_sync_slave_enabled        = 1
rpl_semi_sync_master_timeout       = 1000

############### PATH ##############
basedir                            = /testdb/mysql/5.6.22

datadir                            = /testdb/my3332/data
tmpdir                             = /testdb/my3332/tmp
socket                             = /testdb/my3332/var/mysql.sock
pid_file                           = /testdb/my3332/var/mysql.pid
innodb_data_home_dir               = /testdb/my3332/data

log_error                          = /testdb/my3332/log/error.log
general_log_file                   = /testdb/my3332/log/general.log
slow_query_log_file                = /testdb/my3332/log/slow.log

log_bin                            = /testdb/my3332/log/mysql-bin
log_bin_index                      = /testdb/my3332/log/mysql-bin.index
relay_log                          = /testdb/my3332/log/relay-log
relay_log_index                    = /testdb/my3332/log/relay-log.index

############# INNODB #############
innodb_file_format                 = Barracuda
innodb_flush_method                = O_DIRECT
innodb_buffer_pool_size            = 10000M
innodb_log_file_size               = 256M
innodb_log_files_in_group          = 4
innodb_flush_log_at_trx_commit     = 1
innodb_support_xa                  = ON
innodb_strict_mode                 = ON
innodb_data_file_path              = ibdata1:256M;ibdata2:16M:autoextend
innodb_checksum_algorithm          = strict_crc32
innodb_io_capacity                 = 180
innodb_lock_wait_timeout           = 5

[mysql]
############# CLIENT #############                            
max_allowed_packet                 = 32M
socket                             = /testdb/my3332/var/mysql.sock
[mysqldump]                        
max_allowed_packet                 = 32M           

繼續閱讀