博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MySQL最优配置模板( 5.6&5.7转)
阅读量:5930 次
发布时间:2019-06-19

本文共 4968 字,大约阅读时间需要 16 分钟。

[client]user = root  --用户password = 1111aaA_  -- 密码[mysql]prompt = [\\u@\\p][\\d]>\\_  -- cmd控制台前显示: node1 [localhost] {sa} (mysql)  而不是就是 mysql>no-auto-rehash  --开启命令自动补全功能[mysqld_safe]malloc-lib=tcmalloc  --合适的内存分配算法tcmalloc,是谷歌提供的内存分配管理模块[mysqldump]single-transaction[mysqld]# basic settings #user = mysqlsql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"autocommit = 1  --自动提交事务server-id = 8888   --服务器IDcharacter_set_server=utf8mb4  --服务器数据库的字符集合datadir=/mysql_data/data   --数据目录transaction_isolation = READ-COMMITTED  --数据库隔离级别 ,已提交读explicit_defaults_for_timestamp = 1  --max_allowed_packet = 64M  --最大控制其通信缓冲区的server接受的数据包大小(lob字段)event_scheduler = 1  --开启事件调度# connection #interactive_timeout = 1800wait_timeout = 1800lock_wait_timeout = 1800 skip_name_resolve = 1max_connections = 1024max_user_connections = 256max_connect_errors = 1000000# table cache performance settingstable_open_cache = 4096table_definition_cache = 4096table_open_cache_instances = 64# session memory settings #read_buffer_size = 16Mread_rnd_buffer_size = 32Msort_buffer_size = 32Mtmp_table_size = 64Mjoin_buffer_size = 128Mthread_cache_size = 64# log settings #log_error = error.loglog_bin = binloglog_error_verbosity = 2general_log_file = general.logslow_query_log = 1  --开启慢sql日志slow_query_log_file = slow.log --慢日志文件名log_queries_not_using_indexes = 1log_slow_admin_statements = 1log_slow_slave_statements = 1log_throttle_queries_not_using_indexes = 10expire_logs_days = 90  --日志过期天数long_query_time = 2   --超过2秒的慢sql记录min_examined_row_limit = 100log-bin-trust-function-creators = 1log-slave-updates = 1  --从库产生binlog日志,从库就可以做主库# innodb settings #innodb_page_size = 16384innodb_buffer_pool_size = 160Ginnodb_buffer_pool_instances = 16innodb_buffer_pool_load_at_startup = 1innodb_buffer_pool_dump_at_shutdown = 1innodb_lru_scan_depth = 4096innodb_lock_wait_timeout = 5innodb_io_capacity = 10000innodb_io_capacity_max = 20000innodb_flush_method = O_DIRECTinnodb_undo_logs = 128innodb_undo_tablespaces = 3innodb_flush_neighbors = 0innodb_log_file_size = 16Ginnodb_log_files_in_group = 2innodb_log_buffer_size = 64Minnodb_purge_threads = 4innodb_large_prefix = 1innodb_thread_concurrency = 64innodb_print_all_deadlocks = 1innodb_strict_mode = 1innodb_sort_buffer_size = 128Minnodb_write_io_threads = 16innodb_read_io_threads = 16 innodb_file_per_table = 1innodb_stats_persistent_sample_pages = 64innodb_autoinc_lock_mode = 2innodb_online_alter_log_max_size=1Ginnodb_open_files=4096# replication settings #master_info_repository = TABLE  --master_info存放到数据库表里relay_log_info_repository = TABLE  --relay_log_info存放到数据库表里sync_binlog = 1  --异步日志提交gtid_mode = onenforce_gtid_consistency = 1log_slave_updatesbinlog_format = ROW  --binlog使用row模式binlog_rows_query_log_events = 1relay_log = relay.logrelay_log_recovery = 1  --relay_log出错或者中断,重新从master服务器抽取slave_skip_errors = ddl_exist_errorsslave-rows-search-algorithms = 'INDEX_SCAN,HASH_SCAN'# semi sync replication settings #plugin-load = "group_replication.so;validate_password.so;semisync_master.so;semisync_slave.so"loose_rpl_semi_sync_master_enabled = 1loose_rpl_semi_sync_master_timeout = 3000loose_rpl_semi_sync_slave_enabled = 1# password plugin #validate_password_policy = STRONGvalidate-password = FORCE_PLUS_PERMANENT# perforamnce_schema settingsperformance-schema-instrument='memory/%=COUNTED'performance_schema_digests_size = 40000performance_schema_max_table_instances = 40000performance_schema_max_sql_text_length = 4096performance_schema_max_digest_length = 4096[mysqld-5.6]# metalock performance settingsmetadata_locks_hash_instances = 64[mysqld-5.7]# new innodb settings #loose_innodb_numa_interleave = 1innodb_buffer_pool_dump_pct = 40innodb_page_cleaners = 16innodb_undo_log_truncate = 1innodb_max_undo_log_size = 2Ginnodb_purge_rseg_truncate_frequency = 128# new replication settings #slave-parallel-type = LOGICAL_CLOCK   --开启组提交slave-parallel-workers = 16   --组提交线程数16个slave_preserve_commit_order = 1 slave_transaction_retries = 128# other change settings #binlog_gtid_simple_recovery = 1log_timestamps = systemshow_compatibility_56 = on# group replication settingsplugin-load = "group_replication.so;validate_password.so;semisync_master.so;semisync_slave.so"transaction-write-set-extraction = XXHASH64# report_host = 127.0.0.1 # optional for group replication# binlog_checksum = NONE # only for group replicationloose_group_replication = FORCE_PLUS_PERMANENTloose_group_replication_group_name = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"loose_group_replication_compression_threshold = 100loose_group_replication_flow_control_mode = 0loose_group_replication_single_primary_mode = 0loose_group_replication_enforce_update_everywhere_checks = 1loose_group_replication_transaction_size_limit = 10485760loose_group_replication_unreachable_majority_timeout = 120loose_group_replication_start_on_boot = 0

 

转载于:https://www.cnblogs.com/zping/p/9166209.html

你可能感兴趣的文章
WebScoket支持safari+chrome+firefox的规范和协议
查看>>
php的setcookie函数出现Warning: Warning: Cannot modify h
查看>>
SpringBoot MongoDB 实现事物处理 (windows环境下的副本集创建)
查看>>
Java生成固定格式word并打印word文档解决方案【windows环境】
查看>>
企业文化的作用
查看>>
Linux中的web应用连接windows上的postgresql数据库
查看>>
java service Wrapper配置-D设置外部文件路径提供spring使用
查看>>
bash: bad interpreter: No such file or directory
查看>>
OpenStack Identity Service 身份认证服务——KeyStone
查看>>
共享无线网卡热点给手机上网(win7)
查看>>
OpenLayers IE 6 下 PNG 图片显示问题
查看>>
spring自定义事件和事件监听器以及事件的发布-ApplicationEvent
查看>>
一些前端开发的资源
查看>>
分布式系统基础
查看>>
poj1015 Jury Compromise - dp,背包模型
查看>>
线性表顺序存储-练习题2
查看>>
IOS——关于UIView的autoresizingMask属性的研究
查看>>
KSImageNamed-Xcode-master
查看>>
block 实现原理详解(一)
查看>>
当用户提出需要一匹千里马时,追问一句为什么
查看>>