Detailed explanation of MySQL configuration file my.cnf

[client]
port = 6306
#Client connection port socket = /data/mysql.sock #Socket file
#default-character-set = utf8
[mysql]
#tee=/data/mysql/query.log
prompt = “[\ u@\h][\d]>_”
#You can customize the prompt message connect_timeout = 5 #Connection timeout setting
no-auto-rehash #automatic completion
#default-character-set = utf8
[mysqld]
user=mysql #default Start user mysql
port = 6306
#Service port socket = /data/mysql.sock #Socket file
character-set-server = utf8mb4 #Character set
basedir = /usr/local/mysql-5.7 #Installation directory
datadir = /data/ mydata #Data directory
open_files_limit = 65535
#Maximum open file limit back_log = 1024 #How many records in the stack during the pause request
max_connections = 2000 #Maximum number of connections
max_connect_errors = 100000 ##Maximum number of incorrect connections
external-locking = FALSE # Skip external locking
max_allowed_packet = 128M
#Maximum insert and update size explicit_defaults_for_timestamp=1 #timestamp automatic update
default_authentication_plugin=mysql_native_password # Use "mysql_native_password" plug-in authentication by
default skip_name_resolve = 1 #Do not resolve domain name

log_timestamps=system #Log time is the system time
character-set-client-handshake = FALSE
#Other character sets brought in by the client are invalid character-set-server = utf8mb4 #Service character set
collation-server = utf8mb4 #arrangement character set#
_unicode_ciinit_connect ='SET NAMES utf8mb4'
#default-character-set = utf8mb4
character-set-client-handshake = FALSE #Other character sets that the client is forbidden to bring in
init_connect ='SET NAMES utf8mb4' #initial character set
secure_file_priv=/data #select * into export file directory
table_open_cache = 2048
table_definition_cache = 2048
max_heap_table_size = 96M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 256
query_cache_size = 0
query_cache_type = 0
query_cache_limit = 256K
query_cache_min_res_unit = 512
thread_stack = 192K
tmp_table_size = 96M
key_buffer_size = 32M
read_buffer_size = 8M read_rnd_buffer_size
= 16M
bulk_insert_buffer_size = 32M
#slave-skip-errors=1032,1053,1062 #skip copy error code
=bin 5 rowlog_format
=bin 5 rowlog_format
#Service ID log-bin = /data/my_7301/logs/mysql-bin #binlog directory
log-bin-index =/data/my_7301/logs/mysql-bin.index #binlog index file
binlog_cache_size = 4M #binlog buffer size
max_binlog_size = 1G #binlog maximum
max_binlog_cache_size = 2G #binlog buffer maximum
#sync_binlog = 1
expire_logs_days = 2 #Log expiration time
#replicate-wild-ignore-table=mysql.%
replicate-wild-ignore-table=test.%
replicate-wild-ignore-table=information_schema.%
#replicate-wild-ignore-table=iot_view_test_uat.%
skip_slave_start = 1
max_relay_log_size = 1G
relay_log_purge = 1
relay_log_recovery = 1
log_slave_updates
#slave-skip-errors=1032,1062
slow_query_log = 1
slow_query_log_file = /data/my_7301/logs/slow.log
log-error = /data/my_7301/logs/error.log
long_query_time = 0.5

#timeout
interactive_timeout = 300
wait_timeout = 300
#innodb引擎相关
innodb_buffer_pool_size = 1G
innodb_buffer_pool_instances = 2
innodb_data_file_path = ibdata1:1G:autoextend
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 64M
innodb_log_file_size = 500M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 50
innodb_file_per_table = 1
innodb_rollback_on_timeout = 1
innodb_status_file = 1
innodb_io_capacity = 2000
innodb_io_capacity_max = 4000
innodb_flush_neighbors = 0
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_purge_threads = 4
innodb_page_cleaners = 4
innodb_lru_scan_depth = 4000
innodb_checksum_algorithm = crc32
innodb_lock_wait_timeout = 10
innodb_print_all_deadlocks = 1
innodb_online_alter_log_max_size = 1G
internal_tmp_disk_storage_engine = InnoDB
innodb_stats_on_metadata = 0
innodb_status_file = 1
innodb_status_output_locks = 0
performance_schema = 1
innodb_monitor_enable=“module_innodb”
innodb_monitor_enable=“module_server”
innodb_monitor_enable=“module_dml”
innodb_monitor_enable=“module_ddl”
innodb_monitor_enable=“module_trx”
innodb_monitor_enable=“module_os”
innodb_monitor_enable=“module_purge”
innodb_monitor_enable=“module_log”
innodb_monitor_enable=“module_lock”
innodb_monitor_enable=“module_buffer”
innodb_monitor_enable=“module_index”
innodb_monitor_enable=“module_ibuf_system”
innodb_monitor_enable=“module_buffer_page”
innodb_monitor_enable=“module_adaptive_hash”

transaction_isolation = READ-COMMITTED
innodb_flush_method = O_DIRECT
gtid_mode = ON
enforce_gtid_consistency = ON
master_info_repository = TABLE
relay-log-info-repository = TABLE
binlog_checksum = NONE
log_slave_updates = ON
binlog_row_image=FULL
innodb_thread_concurrency = 0
innodb_sync_spin_loops = 100
innodb_spin_wait_delay = 30

innodb_buffer_pool_load_at_startup =1
innodb_buffer_pool_dump_at_shutdown = 1

#myisam
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 1G
myisam_repair_threads = 1
#server-1
#auto-increment-offset = 1
#auto-increment-increment = 2

#server-2
auto-increment-offset = 2
auto-increment-increment = 2
plugin_dir = /usr/local/mysql-5.7/lib/plugin
#plugin_load = “validate_password.so;rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so”
plugin_load = “rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so” #

loose_rpl_semi_sync_master_enabled = on
loose_rpl_semi_sync_master_timeout = 5000
loose_rpl_semi_sync_master_trace_level = 32
loose_rpl_semi_sync_master_wait_no_slave = on
loose_rpl_semi_sync_slave_enabled = on
loose_rpl_semi_sync_slave_trace_level = 32
loose_rpl_semi_sync_master_enabled = 1
loose_rpl_semi_sync_slave_enabled = 1
loose_rpl_semi_sync_master_timeout = 5000
loose_rpl_semi_sync_master_wait_for_slave_count=1
loose_rpl_semi_sync_master_wait_point=AFTER_SYNC

#slave_preserve_commit_order = 1
slave_transaction_retries = 128
#log_timestamps = system
#show_compatibility_56 = on
slave_parallel_workers = 16
slave_parallel_type = LOGICAL_CLOCK

loose_innodb_numa_interleave = 1
#innodb_buffer_pool_dump_pct = 40
#innodb_page_cleaners = 16
#innodb_undo_log_truncate = 1
#innodb_max_undo_log_size = 2G
#innodb_purge_rseg_truncate_frequency = 128
#transaction_write_set_extraction = MURMUR32

transaction_isolation = READ-COMMITTED
#sql_mode = “STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER”
#sql_mode = “STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER,ONLY_FULL_GROUP_BY”
sql_mode = “STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER”

[mysqldump]
quick
max_allowed_packet = 128M

[mysqld_safe]
#malloc-lib=/usr/local/mysql/lib/jmalloc.so
nice=-19
sync_binlog=20
innodb_flush_log_at_trx_commit=2
open-files-limit=65535

Guess you like

Origin blog.csdn.net/weixin_41667152/article/details/109646616