[Client]default-character-set = utf8mb4[mysql] #开启 tab complement #auto-rehashdefault-character-set = utf8mb4[mysqld]port=3306basedir=/data/server/mysql57/datadir=/data/server/mysql57/data/socket=/ data/server/mysql57/data/mysql.socksymbolic-links=0log-error=/data/logs/mysql57/mysqld.logpid-file=/data/ server/mysql57/data/mysqld57.pid# disabling host name resolution skip-name-resolve# the default database engine default-storage-engine = innodbinnodb-file-per-table=1innodb_force_recovery = 1# some pits group_concat_max_len = 10240sql_mode=expire_logs_days = 7memlock### Character Set Configuration character-set-client-handshake = Falsecharacter-set-server = utf8mb4collation-server = utf8mb4_unicode_ciinit_connect= ' Set names utf8mb4 ' ### gtidserver_id = 330759# to ensure stable GTID replication, Row-level logging binlog_format = row# gtid function gtid_mode = on# protection GTID Transaction security # when Enforce_gtid_consist is enabledency function, # mysql only allows the security of transactions, and can be logged SQL statements are executed,# like Create table ... select The and create temporarytable statements, # and SQL statements or transactions that update both the transaction table and the non-transactional table are not allowed to execute enforce-gtid-consistency = true# The following two configurations are primarily from the switch, database high availability must be configured # on binlog log function log_bin = mysql57-bin # open from Library update binlog log log-slave-updates = on#slave The copy process does not start with MySQL Skip_ slave_start=1### Slow Query Log # Open the slow query log function slow_query_log = 1# more than 2 seconds to record the query long_query_time = 2# records a query that does not use an index log_queries_not_using_indexes = 0slow_query_log_file =/data/logs/ mysql57/slow.log#log=/data/logs/mysql57/all.log### Automatic repair # records relay.info into datasheet relay_log_info _repository = table# records master.info to data sheets master_info_repository = table# Enable relaylog automatic repair relay_log_recovery = on# The SQL thread executes a Automatically delete relay_log_p after relaylog urge = 1### Data Security Configuration # wei Close master Create function function log_bin_trust_ function_creators = on# each execution of a transaction is forced to write to the disk sync_binlog = 1# timestamp column if it is not explicitly defined as not null, supports null property # settings timestamp column value null, will not be set to current timestampexplicit_defaults_for_timestamp=true### optimized configuration # optimization Chinese full-text fuzzy index ft_min_word_len = 1 # Default library Name table name is saved to lowercase, case-insensitive lower_case_table_names = 1# single record write maximum size limit # too small may cause write (import) Data failure max_allowed_packet = 256m# semi-synchronous replication on #rpl_semi_sync_master_enabled = 1#rpl_semi_sync _slave_enabled = 1# semi-synchronous replication time-out setting #rpl_semi_sync_master_timeout = 1000# Copy mode (keeps system default ) #rpl_semi_sync_master_wait_point = AFTER_SYNC# backend as long as there is one receive log and write relaylog even if successful #rpl_semi _sync_master_wait_slave_count = 1# multithreaded replication # parallel replication based on group submissions slave_parallel_type = logical_clock# the number of parallel SQL threads, this parameter onlyIt is only when the 1<n is set up that n threads do SQL redo. #经过测试对比发现, If the connection thread for the main library is m, only m < n, the delay of the, standby can be completely avoided. slave_parallel_workers = 4### connection limit max_connections = 1500# authentication password exceeds 20 deny connection Max_ The Connect_errors = 200# back_log value indicates how many requests can be present in the stack for a short period of time before MySQL temporarily stops answering a new request # that is to say, If the number of connections to MySQL reaches Max_connections, the new request will be present in the stack # to wait for a connection to release the resource, the number of that stack is back_log, if the number of waiting connections exceeds back_log# The number of seconds to wait for activity before the connection resource back_log = 500open_files_limit = 65535# Server closes the interactive connection is not granted interactive_ timeout = 3600# the number of seconds that the server waits for activity before closing a non-interactive connection wait_timeout = 3600### memory allocation # Specifies the size of the table cache. Whenever MySQL accesses a table, if there is space in the table buffer # the table is opened and put into it, so that the table content can be accessed more quickly table_open_cache = 1024# for each session Allocates memory, the maximum size of a temporary table in memory that is used to store the cache of binary logs during a transaction tmp_table_size = 128M# Create the maximum size of the memory table (keep the system default, not allow the creation of oversized memory tables) # If there is a need to use, as a cache, you can adjust this value appropriately max_heap_table_size = 16M# Sequential Read, read-in bufferZone Size setting # full table scan number of words, can adjust this value read_buffer_size = 1m# random read, read into buffer size settings read_rnd_buffer_ size = 8m# high concurrency scenarios, need to reduce this value to 64k-128ksort_buffer_size = 1m# the maximum cache size per query is 1M, Max Cache 64m data query_cache_size = 64mquery_cache_limit = 1m# mentions join Efficiency join_buffer_size = 16m# thread Connection Reuse thread_cache_size = 64### innodb Optimization # # Settings for memory utilization # data buffer innodb_buffer_pool_size=2g## log aspect set # transaction log size innodb_log_file_size = 256M# Log buffer size innodb_log_buffer_size = 4m# buffer innodb_log_buffer_size = of transactions in memory 3M# Main Library Keep system default, transactions are immediately written to disk, do not lose any one transaction innodb_flush_log_at_trx_commit = 1# mysql data File Settings, initial 100, to 10m Auto-expand #innodb_data_file_path = ibdata1:100m:autoextend# To improve performance, mysql can write log files to multiple files in a circular manner innodb_log_files_in_group = 3# #其他设置 # If the tables in the library are particularly numerous, Please increase this value #innodb_open_files = 800# allocates a separate tablespace for each InnoDB table innodb_file_per_table = 1# innodb use the background thread to write on the data page &NBSP;I/O (input) Number of requests innodb_write_io_threads = 8# innodb use background thread to process data on page read i/ O (output) Number of requests innodb_read_io_threads = 8# enable separate threads to reclaim useless data innodb_purge_threads = 1# Dirty data is brushed into the disk (keep the system default, swap too much when, this value, , and disk interaction increased, performance decrease) innodb_max_dirty_ pages_pct = 90# the maximum time a transaction waits to get a resource innodb_lock_wait_timeout = 120# on innodb Strict Check mode, do not warn, Direct error 1 turn 0 off innodb_strict_mode=1# allow column index to reach 3072 innodb_large_ prefix = on[mysqldump]# Enable quick Export Quickdefault-character-set = utf8mb4max_allowed_packet = 256m
MySQL 5.7 my.cnf configuration file description