针对 mysql8.0.22 的配置文件 my.cnf 配置项进行中文标注,以便后面查阅
my.cnf for MySQL 8.0.x
本配置参考 https://imysql.com/my-cnf-wizard.html
注意:
- (1)本配置假设物理服务器内存为 16G,总表数量在300之内,中小型企业业务
- (2)请根据实际情况作调整部分参数
- (3)本人不对这些建议结果负相应责任 ,仅作参考
[client]
port = 3306
socket =/var/lib/mysql/mysqld.sock
[mysql]
no-auto-rehash
[mysqld]
port = 3306
datadir = /var/lib/mysql
socket = /var/lib/mysql/mysqld.sock
log-error = /var/lib/mysql/error.log
pid-file = /var/lib/mysql/mysqld.pid
skip_name_resolve = 1
default_time_zone = "+8:00"
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
init_connect='SET NAMES utf8mb4'
lower_case_table_names = 1
transaction_isolation = READ-COMMITTED
explicit_defaults_for_timestamp = true
open_files_limit = 65535
max_connections = 300
max_connect_errors = 600
back_log = 110
table_open_cache = 600
table_definition_cache = 700
table_open_cache_instances = 64
thread_stack = 512K
external-locking = FALSE
max_allowed_packet = 128M
sort_buffer_size = 4M
join_buffer_size = 4M
thread_cache_size = 20
interactive_timeout = 1800
wait_timeout = 1800
lock_wait_timeout = 3600
tmp_table_size = 64M
max_heap_table_size = 64M
slow_query_log = 1
log_timestamps = SYSTEM
slow_query_log_file = /var/lib/mysql/slow.log
long_query_time = 5
log_queries_not_using_indexes = 0
log_throttle_queries_not_using_indexes = 60
min_examined_row_limit = 5000
log_slow_admin_statements = 0
log_slow_slave_statements = 1
server-id = 110
log-bin=mysql-bin
binlog_format = ROW
binlog_row_image = FULL
binlog_expire_logs_seconds = 1209600
master_info_repository = TABLE
relay_log_info_repository = TABLE
log_slave_updates
relay_log_recovery = 1
slave_skip_errors = ddl_exist_errors
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
binlog_cache_size = 4M
max_binlog_cache_size = 2G
max_binlog_size = 1G
gtid_mode = on
enforce_gtid_consistency = 1
key_buffer_size = 15M
read_buffer_size = 8M
read_rnd_buffer_size = 4M
bulk_insert_buffer_size = 64M
innodb_thread_concurrency = 0
innodb_buffer_pool_size = 8G
innodb_buffer_pool_instances = 4
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_data_file_path = ibdata1:1G:autoextend
innodb_log_buffer_size = 32M
innodb_log_files_in_group = 3
innodb_log_file_size = 2G
innodb_undo_log_truncate = 1
innodb_max_undo_log_size = 4G
innodb_io_capacity = 4000
innodb_io_capacity_max = 8000
innodb_flush_sync = 0
innodb_flush_neighbors = 0
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_purge_threads = 4
innodb_page_cleaners = 4
innodb_open_files = 65535
innodb_max_dirty_pages_pct = 50
innodb_flush_method = O_DIRECT
innodb_lru_scan_depth = 4000
innodb_checksum_algorithm = crc32
innodb_lock_wait_timeout = 20
innodb_rollback_on_timeout = 1
innodb_print_all_deadlocks = 1
innodb_sort_buffer_size = 67108864
innodb_autoinc_lock_mode = 1
innodb_file_per_table = 1
innodb_online_alter_log_max_size = 4G
[mysqldump]
quick
max_allowed_packet = 128M
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)