mysql8.0-cnf文件

2024-01-30 11:44
文章标签 mysql mysql8.0 database cnf

本文主要是介绍mysql8.0-cnf文件,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

一、my.cnf 文件

注意:根据自己环境进行参数的调整。

[client]
port = 3307
socket  = /data/mysql8.0.35/3307/tmp/mysql.sock[mysqldump]
quick
max_allowed_packet = 64M[mysql]
prompt="\u@\h: \R:\m:\s [\d]> "
no-auto-rehash[mysqld]
###### BASIC SETTINGS ######
server-id = 303307
user = mysql
port = 3307
basedir = /data/mysql8.0.35/install
tmpdir = /data/mysql8.0.35/3307/tmp
datadir = /data/mysql8.0.35/3307/data
pid-file = /data/mysql8.0.35/3307/tmp/mysql.pid
socket  = /data/mysql8.0.35/3307/tmp/mysql.sockcharacter-set-server = utf8mb4
transaction_isolation = READ-COMMITTED
explicit_defaults_for_timestamp = 1
max_allowed_packet = 32M
open_files_limit = 65535
sql_mode = NO_ENGINE_SUBSTITUTION
group_concat_max_len = 1024000
lock_wait_timeout = 120
skip_name_resolve = 1
#不区分大小写
lower-case-table-names = 1
default_time_zone = "+8:00"  #沿用5.7的密码认证
default_authentication_plugin = mysql_native_password
log_bin_trust_function_creators = 1###### PASSWORD POLICY AND CONNECT CONTROL ######
plugin_dir=/data/mysql8.0.35/install/lib/plugin
plugin-load-add = validate_password.so###### CACHES AND CONNECTS SESSION ######
table_definition_cache = 2048
table_open_cache = 10240
table_open_cache_instances = 16
read_buffer_size = 4M                 
read_rnd_buffer_size = 8M   
sort_buffer_size = 8M                 
join_buffer_size =  8M                
tmp_table_size =  16M   
max_heap_table_size = 64M
thread_cache_size = 128
thread_stack = 512K
key_buffer_size = 4M
max_length_for_sort_data = 8096
bulk_insert_buffer_size = 4M###### CONNECTION SETTINGS ######
interactive_timeout = 300
wait_timeout = 300
max_connections = 3000
max_user_connections = 0
max_connect_errors = 1000
back_log = 2048###### LOG SETTINGS ######
log-error = /data/mysql8.0.35/3307/logs/error.log
slow_query_log_file = /data/mysql8.0.35/3307/logs/slow.log
log-bin = /data/mysql8.0.35/3307/binlog/mysql-bin
relay-log = /data/mysql8.0.35/3307/relaylog/mysql-relay-binslow_query_log = 1
long_query_time = 1
log_queries_not_using_indexes =1
log_throttle_queries_not_using_indexes = 60
min_examined_row_limit = 1000
log_slow_admin_statements = 1
log_slow_slave_statements = 1binlog_format = row
binlog_row_image = full
binlog_cache_size = 4M
max_binlog_cache_size = 2G
max_binlog_size = 1G
# binlog过期时间,8.0已废弃
# expire_logs_days = 7skip_slave_start = 1
max_relay_log_size = 500M
relay_log_recovery = 1
relay-log-purge = 1
master_info_repository = TABLE
relay_log_info_repository = TABLE
log_timestamps = SYSTEM
binlog_checksum = 1gtid_mode = on
log_slave_updates = 1
enforce_gtid_consistency = 1
binlog_gtid_simple_recovery = 1#log security
#sync_binlog = 1
#innodb_flush_log_at_trx_commit = 1sync_binlog = 1000
innodb_flush_log_at_trx_commit = 2###### REPLICATION SETTINGS ######   并行复制
slave_parallel_type = LOGICAL_CLOCK
slave_parallel_workers = 4
slave_preserve_commit_order = on
#binlog-transaction-dependency-tracking = commit_order
#如果在同一台主机部署多个实例,并启动增强半同步,需指定以下参数
mysqlx_socket=/data/mysql/tmp/mysqlx.sock
mysqlx_port = 13308###### semi sync replication settings ######   增强半同步复制
#plugin_dir=/data/mysql8.0.35/install/lib/plugin
#plugin_load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"
#loose_rpl_semi_sync_master_enabled = 1
#loose_rpl_semi_sync_slave_enabled = 1
#loose_rpl_semi_sync_master_timeout = 5000###### INNODB SETTINGS ######
#企业级部署,可以直接初始化10G
innodb_buffer_pool_size = 7G
innodb_buffer_pool_instances = 8
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
#innodb_data_file_path = ibdata1:128M;ibdata2:128M:autoextend
innodb_lru_scan_depth = 4096
innodb_lock_wait_timeout = 10
innodb_io_capacity = 10000
innodb_io_capacity_max = 15000
innodb_flush_method = O_DIRECT
#innodb_undo_tablespaces已废弃,innodb默认创建2个undo表空间,如果需要更多,后期使用CREATE UNDO TABLESPACE命令进行添加
#innodb_undo_tablespaces = 127
innodb_max_undo_log_size = 4G
innodb_undo_log_truncate = 1
innodb_flush_neighbors = 0
innodb_log_file_size = 2G
innodb_log_files_in_group = 5
innodb_log_buffer_size = 32M
#在mysql8.0已废弃innodb_large_prefix
#innodb_large_prefix = 1
innodb_thread_concurrency = 0
innodb_print_all_deadlocks = 1
innodb_strict_mode = 1
innodb_purge_threads = 4
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_page_cleaners = 8
innodb_sort_buffer_size = 32M
innodb_file_per_table = 1
innodb_stats_persistent_sample_pages = 64
innodb_autoinc_lock_mode = 2
innodb_online_alter_log_max_size = 4G
innodb_open_files = 65535
innodb_checksum_algorithm = crc32
innodb_rollback_on_timeout = 1
#内部临时表的存储引擎,在mysql8.0.16中已废弃
#internal_tmp_disk_storage_engine = InnoDB
innodb_status_file = 1
innodb_status_output = 0
innodb_status_output_locks = 0
innodb_sync_spin_loops = 100
innodb_spin_wait_delay = 30
innodb_flush_sync = 0
innodb_max_dirty_pages_pct = 50
innodb_stats_on_metadata = 0###### some var for MySQL 8 ######
log_error_verbosity = 3
innodb_print_ddl_logs = 1
#binlog过期时间,604800秒 即7天
binlog_expire_logs_seconds = 604800
innodb_dedicated_server = OFF###### PERFORMANCE_SCHEMA SETTINGS ######
performance_schema = 1
performance_schema_instrument = '%=on'
performance_schema_digests_size = 40000
performance_schema_max_table_instances = 40000
performance_schema_max_sql_text_length = 4096
performance_schema_max_digest_length = 4096
performance-schema-instrument='stage/%=ON'
performance-schema-consumer-events-stages-current=ON
performance-schema-consumer-events-stages-history=ON
performance-schema-consumer-events-stages-history-long=ON
performance-schema-consumer-events-transactions-history-long=ON###### INNODB MONITOR ######    监控
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"###### group replication settings ######
read_only=1
#super_read_only=1
binlog_transaction_dependency_tracking = WRITESET
transaction-write-set-extraction = XXHASH64
binlog_transaction_dependency_history_size = 25000
loose-group_replication_auto_increment_increment = 1
# report_host = 127.0.0.1 # optional for group replication
binlog_checksum = NONE # only for group replication
loose-group_replication_group_name = 'd8316b12-a119-4850-bdb1-37275c5a3f3f'    #用于配置组复制的组名
loose-group_replication_start_on_boot = off
loose-group_replication_local_address = 192.168.111.30:13307		#本地组复制成员的 IP 地址和端口号
loose-group_replication_group_seeds = "192.168.111.30:13307,192.168.111.31:13307,192.168.111.32:13307"		#组复制集群的种子成员的 IP 地址和端口号
loose_group_replication_ip_whitelist= "192.168.111.0/24"	#允许连接到组复制成员的 IP 地址列表,限制允许访问 Group Replication 成员的客户端 IP 地址
loose-group_replication_bootstrap_group = off
#set single primary
loose_group_replication_single_primary_mode = on
loose_group_replication_enforce_update_everywhere_checks = off
# turn off Flow control
loose_group_replication_flow_control_mode = DISABLED
loose_group_replication_unreachable_majority_timeout = 30        #网络不可达时,10秒后被踢出集群,状态变为error
loose_group_replication_transaction_size_limit = 20971520        #允许的事务大小,建议20M,默认不限制
loose_group_replication_autorejoin_tries = 3                     #auto-rejoin,重试加入集群,8.0.16以上支持
loose_group_replication_compression_threshold = 131072
loose_group_replication_member_weight = 50                       #权重在主库可以设置为60
#compress binlog, ratio: 50%    #以下2个参数仅适用于8.0.20及以上版本
binlog_transaction_compression = on
binlog_transaction_compression_level_zstd = 10###### 参数配置######
#基本参数
#port=
#server_id=#innodb_buffer_pool_size=
#read_buffer_size=       
#read_rnd_buffer_size=
#sort_buffer_size=   
#join_buffer_size=    
#tmp_table_size=#mgr配置
#loose_group_replication_group_name=
#loose_group_replication_local_address=
#report_host=
#loose_group_replication_group_seeds=
#loose_group_replication_ip_whitelist=

这篇关于mysql8.0-cnf文件的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/660134

相关文章

MySQL中EXISTS与IN用法使用与对比分析

《MySQL中EXISTS与IN用法使用与对比分析》在MySQL中,EXISTS和IN都用于子查询中根据另一个查询的结果来过滤主查询的记录,本文将基于工作原理、效率和应用场景进行全面对比... 目录一、基本用法详解1. IN 运算符2. EXISTS 运算符二、EXISTS 与 IN 的选择策略三、性能对比

MySQL常用字符串函数示例和场景介绍

《MySQL常用字符串函数示例和场景介绍》MySQL提供了丰富的字符串函数帮助我们高效地对字符串进行处理、转换和分析,本文我将全面且深入地介绍MySQL常用的字符串函数,并结合具体示例和场景,帮你熟练... 目录一、字符串函数概述1.1 字符串函数的作用1.2 字符串函数分类二、字符串长度与统计函数2.1

SQL Server跟踪自动统计信息更新实战指南

《SQLServer跟踪自动统计信息更新实战指南》本文详解SQLServer自动统计信息更新的跟踪方法,推荐使用扩展事件实时捕获更新操作及详细信息,同时结合系统视图快速检查统计信息状态,重点强调修... 目录SQL Server 如何跟踪自动统计信息更新:深入解析与实战指南 核心跟踪方法1️⃣ 利用系统目录

MySQL 内存使用率常用分析语句

《MySQL内存使用率常用分析语句》用户整理了MySQL内存占用过高的分析方法,涵盖操作系统层确认及数据库层bufferpool、内存模块差值、线程状态、performance_schema性能数据... 目录一、 OS层二、 DB层1. 全局情况2. 内存占js用详情最近连续遇到mysql内存占用过高导致

Mysql中设计数据表的过程解析

《Mysql中设计数据表的过程解析》数据库约束通过NOTNULL、UNIQUE、DEFAULT、主键和外键等规则保障数据完整性,自动校验数据,减少人工错误,提升数据一致性和业务逻辑严谨性,本文介绍My... 目录1.引言2.NOT NULL——制定某列不可以存储NULL值2.UNIQUE——保证某一列的每一

解密SQL查询语句执行的过程

《解密SQL查询语句执行的过程》文章讲解了SQL语句的执行流程,涵盖解析、优化、执行三个核心阶段,并介绍执行计划查看方法EXPLAIN,同时提出性能优化技巧如合理使用索引、避免SELECT*、JOIN... 目录1. SQL语句的基本结构2. SQL语句的执行过程3. SQL语句的执行计划4. 常见的性能优

SQL Server 中的 WITH (NOLOCK) 示例详解

《SQLServer中的WITH(NOLOCK)示例详解》SQLServer中的WITH(NOLOCK)是一种表提示,等同于READUNCOMMITTED隔离级别,允许查询在不获取共享锁的情... 目录SQL Server 中的 WITH (NOLOCK) 详解一、WITH (NOLOCK) 的本质二、工作

MySQL 强制使用特定索引的操作

《MySQL强制使用特定索引的操作》MySQL可通过FORCEINDEX、USEINDEX等语法强制查询使用特定索引,但优化器可能不采纳,需结合EXPLAIN分析执行计划,避免性能下降,注意版本差异... 目录1. 使用FORCE INDEX语法2. 使用USE INDEX语法3. 使用IGNORE IND

SQL Server安装时候没有中文选项的解决方法

《SQLServer安装时候没有中文选项的解决方法》用户安装SQLServer时界面全英文,无中文选项,通过修改安装设置中的国家或地区为中文中国,重启安装程序后界面恢复中文,解决了问题,对SQLSe... 你是不是在安装SQL Server时候发现安装界面和别人不同,并且无论如何都没有中文选项?这个问题也

2025版mysql8.0.41 winx64 手动安装详细教程

《2025版mysql8.0.41winx64手动安装详细教程》本文指导Windows系统下MySQL安装配置,包含解压、设置环境变量、my.ini配置、初始化密码获取、服务安装与手动启动等步骤,... 目录一、下载安装包二、配置环境变量三、安装配置四、启动 mysql 服务,修改密码一、下载安装包安装地