龙空技术网

分享mysql配置文件my.cnf一键生成器

雪竹聊技术 2669

前言:

现在大家对“mysql配置mycnf”都比较注意,你们都想要知道一些“mysql配置mycnf”的相关内容。那么小编也在网上收集了一些对于“mysql配置mycnf””的相关内容,希望咱们能喜欢,你们快快来学习一下吧!

一、概述

作为DBA或系统运维人员在安装或配置mysql的过程中,经常遇到mysql的配置文件参数不知如何设置?哪些参数需要设置?参数值设置为多少比较合理。下面分享一个在线生成mysql的生成器,帮你解决以上烦忧。

二、过程

2.1 填写相关配置

1、填写相关参数,点击生成。

2、填写参数说明

CPU:CPU逻辑核数内存大小:部署mysql机器内存大小磁盘类型:SSD或HDDMYSQL版本:5.6、5.7、8.0架构:单机、主从、MGRbasedir:程序目录datadir:数据目录的父目录 监听端口:3306

2.2 生成配置文件展示

配置说明:

CPU:4核内存:16G磁盘:SSDMYSQL版本:5.7架构:单机base_dir:/usr/local/mysql/datadir:/data/mysql/data/

[mysql]auto-rehashsocket =/tmp/mysql.sock # /tmp/mysql.sock​​[mysqld]####: for globaluser =mysql # mysqlbasedir =/usr/local/mysql/ # /usr/local/mysql/datadir =/data/mysql/data/3306/ # /usr/local/mysql/dataserver_id =1980 # 0port =3306 # 3306character_set_server =utf8 # latin1log_bin_trust_function_creators =ON # 0max_prepared_stmt_count =1048576 # log_timestamps =system # utcsocket =/tmp/mysql.sock # /tmp/mysql.sockread_only =OFF # offskip_name_resolve =1 # 0auto_increment_increment =1 # 1auto_increment_offset =1 # 1lower_case_table_names =1 # 0secure_file_priv = # nullopen_files_limit =65536 # 1024max_connections =512 # 151thread_cache_size =64 # 9table_open_cache =4000 # 2000table_definition_cache =2000 # 1400table_open_cache_instances =32 # 16​####: for binlogbinlog_format =ROW # rowlog_bin =mysql-bin # offbinlog_rows_query_log_events =ON # offlog_slave_updates =ON # offexpire_logs_days =7 # 0binlog_cache_size =96k # 65536(64k)binlog_checksum =none # CRC32sync_binlog =1 # 1slave-preserve-commit-order =ON # ​####: for error-loglog_error =err.log # /usr/local/mysql/data/localhost.localdomain.err​####: for general-loggeneral_log =OFF # offgeneral_log_file =general.log # hostname.log​####: for slow query logslow_query_log =ON # offslow_query_log_file =slow.log # hostname.loglog_queries_not_using_indexes =OFF # offlong_query_time =2.0 # 10.000000​####: for gtidgtid_executed_compression_period =1000 # 1000gtid_mode =ON # offenforce_gtid_consistency =ON # off​​####: for replicationskip_slave_start =0 # master_info_repository =table # filerelay_log_info_repository =table # fileslave_parallel_type =logical_clock # database | LOGICAL_CLOCKslave_parallel_workers =4 # 0rpl_semi_sync_master_enabled =1 # 0rpl_semi_sync_slave_enabled =1 # 0rpl_semi_sync_master_timeout =1000 # 1000(1 second)plugin_load_add =semisync_master.so #plugin_load_add =semisync_slave.so #binlog_group_commit_sync_delay =4000 # 0 4000(4ms) binlog_group_commit_sync_no_delay_count = 10 # 0binlog_transaction_dependency_tracking = WRITESET # COMMIT_ORDER | WRITESET transaction_write_set_extraction = XXHASH64​​####: for innodbdefault_storage_engine =innodb # innodbdefault_tmp_storage_engine =innodb # innodbinnodb_data_file_path =ibdata1:256M;ibdata2:256M:autoextend # ibdata1:12M:autoextendinnodb_temp_data_file_path =ibtmp1:64M:autoextend # ibtmp1:12M:autoextendinnodb_buffer_pool_filename =ib_buffer_pool # ib_buffer_poolinnodb_log_group_home_dir =./ # ./innodb_log_files_in_group =8 # 2innodb_log_file_size =128M # 50331648(48M)innodb_file_per_table =ON # oninnodb_online_alter_log_max_size =128M # 134217728(128M)innodb_open_files =64000 # 2000innodb_page_size =16k # 16384(16k)innodb_thread_concurrency =0 # 0innodb_read_io_threads =4 # 4innodb_write_io_threads =4 # 4innodb_purge_threads =4 # 4(garbage collection)innodb_page_cleaners =4 # 4(flush lru list)innodb_print_all_deadlocks =ON # offinnodb_deadlock_detect =ON # oninnodb_lock_wait_timeout =50 # 50innodb_spin_wait_delay =6 # 6innodb_autoinc_lock_mode =2 # 1innodb_flush_sync =OFF # oninnodb_io_capacity =4000 # 200innodb_io_capacity_max =20000 # 2000#--------Persistent Optimizer Statisticsinnodb_stats_auto_recalc =ON # oninnodb_stats_persistent =ON # oninnodb_stats_persistent_sample_pages =20 # 20innodb_buffer_pool_instances =10 # 1innodb_adaptive_hash_index =ON # oninnodb_change_buffering =all # allinnodb_change_buffer_max_size =25 # 25innodb_flush_neighbors =0 # 1innodb_flush_method =O_DIRECT # innodb_doublewrite =ON # oninnodb_log_buffer_size =256M # 16777216(16M)innodb_flush_log_at_timeout =1 # 1innodb_flush_log_at_trx_commit =1 # 1innodb_buffer_pool_size =10G # 128Mautocommit =ON # 1#--------innodb scan resistantinnodb_old_blocks_pct =37 # 37innodb_old_blocks_time =1000 # 1000#--------innodb read aheadinnodb_read_ahead_threshold =56 # 56 (0..64)innodb_random_read_ahead =off # OFF#--------innodb buffer pool stateinnodb_buffer_pool_dump_pct =50 # 25 innodb_buffer_pool_dump_at_shutdown =ON # ONinnodb_buffer_pool_load_at_startup =ON # ON​​​​​#### for performance_schemaperformance_schema =on # onperformance_schema_consumer_global_instrumentation =on # onperformance_schema_consumer_thread_instrumentation =on # onperformance_schema_consumer_events_stages_current =on # offperformance_schema_consumer_events_stages_history =on # offperformance_schema_consumer_events_stages_history_long =off # offperformance_schema_consumer_statements_digest =on # onperformance_schema_consumer_events_statements_current =on # onperformance_schema_consumer_events_statements_history =on # onperformance_schema_consumer_events_statements_history_long =off # offperformance_schema_consumer_events_waits_current =on # offperformance_schema_consumer_events_waits_history =on # offperformance_schema_consumer_events_waits_history_long =off # offperformance-schema-instrument ='memory/%=COUNTED'
三、小结

1、此小工具非常便捷生成mysql的配置文件,是你配置mysql的好帮手。

2、生成器网址获取方式:

转发+关注,然后私信回复“生成器”,即可获取地址。

标签: #mysql配置mycnf