1, user = mysql # start the mysql user.
2, pid-file = /var/run/mysqld/mysqld.pid # pid file specified.
3, socket = /var/run/mysqld/mysqld.sock # specified socket file.
4, port = 3306 # start mysql designated port to use
5, basedir = / usr # installed root
6, datadir = / var / lib / mysql # data directory
7, server-id = 1 #mysql service id, globally unique .
8, tmpdir = / tmp # temporary directory will be used, such as load data infile
9, skip-external-locking # MyISAM storage engine is mainly used, if multiple servers connected to a content database is recommended that the following comment
10, collation = utf8_unicode_ci-Server # database character set some sort of correspondence and other rules, and pay attention to the corresponding character-set-server
. 11, the init-Connect = 'the SET NAMES UTF8' # set the client character set is connected mysql, to prevent distortion
12 is, Character-SET-Server UTF8 = # database default character set, character set support mainstream special emoticons (emoticon special 4 bytes)
13, skip-name-resolve or skip_name_resolve = 1 # skip domain name resolution, for mysql improve processing speed.
14, transaction_isolation = the READ-COMMITTED # transaction isolation level, the default is repeatable read, mysql default Repeatable Read (probably many parameters gap lock this level, affect performance)
15, the sql_mode = the STRICT_TRANS_TABLES, the NO_ZERO_IN_DATE, the NO_ZERO_DATE, the ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER , NO_ENGINE_SUBSTITUTION # turn off ONLY_FULL_GROUP_BY, otherwise an error in mysql5.7 version next time.
# Sql statement whether case-sensitive, 1 represents insensitive
lower_case_table_names = 1
# maximum number of connections
max_connections = 400
# The maximum number of errors connected to
the max_connect_errors = 1000
#timestamp If not declared NOT NULL, NULL values are allowed
explicit_defaults_for_timestamp to true =
#sql packet the size of sending, if an object may change this BLOB. 1G
the max_allowed_packet 128M =
#MySQL connections are idle for more than a certain time (unit: second) will be forced to close
#MySQL wait_timeout default is 8 hours, interactive_timeout seconds parameters required to configure the entry into force
interactive_timeout = 1800
wait_timeout = 1800
maximum # of internal memory temporary tables, set to 128M.
# For example, a large amount of data group by, may be used when the order by the temporary table
# exceeds this value will be written to disk IO system pressure increases
tmp_table_size = 134217728
max_heap_table_size = 134217728
# disable mysql query result set caching function
post-# according to tests to determine whether to open the business case
close the case in most cases below two #
= 0 query_cache_size
query_cache_type = 0
##################### user process to allocate memory settings BEGIN ############### ##############
## will be assigned to each session parameter memory size
sequentially scanning a table of #, the read data is temporarily stored in read_buffer_size when full or buff reading the data back to the previous caller
# general 128kb ~ 256kb, for MyISAM
#read_buffer_size = 131072
# table for the random read when reading sorted according to a non-indexed fields will be used,
# general 128kb ~ 256kb, for MyISAM
#read_rnd_buffer_size = 262144
used when #order by or by Group
# recommended to be adjusted to 2M, the latter observed adjustment
sort_buffer_size = 2097152
# generally no big database transaction, set to 1 ~ 2M, the default 32KB
binlog_cache_size = 524288
######################## memory allocated to the user process is provided END ################ ############
short period of time before the number of requests in response to a new request to temporarily stop the # MySQL may be the presence of the stack
# official suggested back_log = 50 + (max_connections / 5 ), the number is capped at 900
back_log = 130
############################ log settings ################# #########################
# database error log files
log_error = error.log
# sql slow query log settings
slow_query_log = 1
slow_query_log_file = slow.log
# examination did not use to index sql
log_queries_not_using_indexes = 1
# for the log_queries_not_using_indexes opening, recording the frequency of slow sql, article number per minute recorded
log_throttle_queries_not_using_indexes = 5
# as effective when the library from the library copy in how to have slow sql will be recorded
= 1 log_slow_slave_statements
# number of seconds slower query execution, must reach this value can be recorded
long_query_time = 8
rows # retrieve this value must reach before being referred to as slow query
min_examined_row_limit = 100
#mysql binlog log files are saved expiration time, automatically deleted after expiration
expire_logs_days = 5
############################ from the master copy set ################## ###################
Open function # mysql binlog
log-bin bin-MySQL =
#binlog recorded content manner, the recording operation of each line is
binlog_format = ROW
# binlog_format = ROW respect to the pattern, to reduce the content of the log records only affected columns
binlog_row_image = minimal
#MASTER and Connection Status Information output to the table mysql.slave_master_info in
master_info_repository = tABLE
the #The Slave's position in the table at the Relay logs output to mysql.slave_relay_log_info in
relay_log_info_repository = tABLE
# take effect as from the library, want to cascading replication, you need to this parameter
log_slave_updates
# library take effect as from the relay log relay-log self-healing
relay_log_recovery = 1
# library take effect as from the main ignored when copying from the mistakes
slave_skip_errors = ddl_exist_errors
########### relations ########## redo log and binlog set BEGIN #########################
# (Step 1) prepare dml related SQL operations, then redo log buff in cache persisted to disk
# (Step 2) If the previous prepare successful, then continue the transaction log persistence to the binlog
# (Step 3) If earlier success, then write a commit record in the redo log inside
# when innodb_flush_log_at_trx_commit and sync_binlog are 1 is the safest,
# crashes or if the server host crash in mysqld service, binary log only likely to lose at most one statement or a affairs.
# But are set to cause frequent operation io 1, this mode is the slowest way.
# When innodb_flush_log_at_trx_commit set to 0, mysqld process crash can cause the loss of a second on all transaction data.
# When innodb_flush_log_at_trx_commit set to 2, only in the case of an operating system crash or power down the system, all transaction data on a second it might be lost.
When #commit transaction, control redo log buff persistent disk default mode. 1
the innodb_flush_log_at_trx_commit = 2
when #commit transaction, controls the writing of the log mysql binlog default mode 0
#innodb_flush_log_at_trx_commit and sync_binlog both is 1, mysql most secure but performance the pressure is also the largest
sync_binlog. 1 =
########### ######### redo log and binlog relationship set END ############################
############################ Innodb set #################### #################
unit 8k # data block, default 16k, 16kCPU smaller pressure, 8k to select a certain large
parameter values #innodb_page_size also affect the maximum index length , 8k 16k than the maximum index length smaller
#innodb_page_size = 8192
# general physical storage provided ~% 70% 60
innodb_buffer_pool_size. 1G =
after 5.7.6 default # 16M
#innodb_log_buffer_size = 16777216
# the parameters for the unix, linux, window directly annotations the parameter default value is NULL
#O_DIRECT reduce conflicts between the operating system level VFS cache and buffer cache itself Innodb
innodb_flush_method the O_DIRECT =
# this format supports compression, then the default value 5.7.7
innodb_file_format = Barracuda
#CPU multi-core processing provided, assuming CPU is 2 4 core is provided as
# read multiple, write less can be set to 2: 6 ratio
innodb_write_io_threads = 4
innodb_read_io_threads = 4
# increase the number of refresh and the combined amount of insertion dirty pages, improved disk I / O processing capability
# default value of 200 (unit: p)
# may be determined based on a recent IOPS disk the value
innodb_io_capacity = 500
# in order to obtain maximum resource waiting time is locked, the default 50 seconds, this time is exceeded will be reported the following error:
# ERROR 1205 (HY000): Lock the wait timeout exceeded Number of; the try Restarting Transaction
innodb_lock_wait_timeout = 30
the percentage adjustment buffer pool # recently used page read and to dump, by setting this parameter reduces the number of page dumps
innodb_buffer_pool_dump_pct = 40
directory file # redolog provided, the specific operation contents redolog transaction records
innodb_log_group_home_dir = / opt / MySQL / redolog /
# settings file directory undoLog, undoLog transaction for rollback
innodb_undo_directory = / opt / MySQL / undolog /
# innodb_log_group_home_dir in the number of files redolog, redoLog content file is overwritten cycle.
= 3 innodb_log_files_in_group
# bigger MySql5.7 official recommended to set up, can be close to the size of innodb_buffer_pool_size
set the value before the # mysql downtime can lead to large recovery time is too long, and now the recovery has accelerated a lot
# reduce the value of the dirty data flushed to disk frequency
# Maximum innodb_log_file_size * innodb_log_files_in_group <= 512GB, single-file <= 256GB
the innodb_log_file_size = 1024M
# Set undoLog file takes be recovered
undoLog MySql file before the # 5.7 has been increased can not be recovered
innodb_undo_log_truncate. 1 =
innodb_undo_tablespaces =. 3
innodb_undo_logs = 128
# 5.7.7 default on this parameter controls the maximum length of a separate index reaches 3072
. 1 #innodb_large_prefix =
# 5.7.8 default is four, the number of threads Inodb background cleanup work
#innodb_purge_threads. 4 =
# of concurrent threads is limited by the number of configuration parameters innodb_thread_concurrency , #
number of execution threads once this limit is reached, additional threads are placed in a queue before the pair will sleep for a few microseconds,
# parameters may be configured by setting the sleep time innodb_thread_sleep_delay
# 0 is the default value, in the official doc on innodb_thread_concurrency for use, but also it gives some suggestions:
### and through continuous reduction in the Number, 96, 80, 64 and so on until it finds the number of threads to provide the best performance
# (1) if a workload, number of concurrent users is smaller than the threads 64, it is recommended to set innodb_thread_concurrency = 0;
# (2) if the workload has been more serious and even occasionally peaked, it is recommended to set = 128 innodb_thread_concurrency,
= 0 #innodb_thread_concurrency
# strong all deadlock errors that can occur in error.log recorded before the command line can only view the most recent deadlock information
innodb_print_all_deadlocks = 1
= Port 3306 is connected server default port #
Socket = / var / RUN / mysqld / mysqld.sock # soce file server, and the server is provided as required
default -character- SET = UTF8 # connection to the server using the character set
password = 123456 # connection password
user = root # default connection port
[mysqldump]
Quick
max_allowed_packet = 128M
[MySQL]
NO -auto- rehash
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 256K
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
Interactive - timeout
[mysqld_safe]
# each process can increase the number of open files
open -limit = -files 28192