mysql8配置文件my.ini讲解,原汁原味直接拷贝再讲解

发布于:2025-05-22 ⋅ 阅读:(18) ⋅ 点赞:(0)

一、原英文版本,不带注释

# Other default tuning values
# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
# (@localstatedir@ for this installation) or to
# ~/.my.cnf to set user-specific options.
#
# On Windows, when MySQL has been installed using MySQL Installer you
# should keep this file in the ProgramData directory of your server
# (e.g. C:\ProgramData\MySQL\MySQL Server X.Y). To make sure the server
# reads the config file, use the startup option "--defaults-file". 
#
# To run the server from the command line, execute this in a 
# command line shell, e.g.
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# To install the server as a Windows service manually, execute this in a 
# command line shell, e.g.
# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# And then execute this in a command line shell to start the server, e.g.
# net start MySQLXY
#
#
# Guidelines for editing this file
# ----------------------------------------------------------------------
#
# In this file, you can use all long options that the program supports.
# If you want to know the options a program supports, start the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#
# For advice on how to change settings please see
# https://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
#
#
# CLIENT SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]

# pipe=

# socket=MYSQL

port=3306

[mysql]
no-beep

# default-character-set=

# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
# server_type=3
[mysqld]

# The next three options are mutually exclusive to SERVER_PORT below.
# skip-networking
# enable-named-pipe
# shared-memory

# shared-memory-base-name=MYSQL

# The Pipe the MySQL Server will use.
# socket=MYSQL

# The access control granted to clients on the named pipe created by the MySQL Server.
# named-pipe-full-access-group=

# The TCP/IP Port the MySQL Server will listen on
port=3306

# Path to installation directory. All paths are usually resolved relative to this.
# basedir="C:/Program Files/MySQL/MySQL Server 8.0/"

# Path to the database root
datadir=C:/ProgramData/MySQL/MySQL Server 8.0\Data

# The default character set that will be used when a new schema or table is
# created and no character set is defined
# character-set-server=


# Administers multifactor authentication (MFA) capabilities. It applies to the authentication
# factor-related clauses of CREATE USER and ALTER USER statements used to manage MySQL account
# definitions, where “factor” corresponds to an authentication method or plugin associated
# with an account.
authentication_policy=*,,

# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB

# The current server SQL mode, which can be set dynamically.
# Modes affect the SQL syntax MySQL supports and the data validation checks it performs. This 
# makes it easier to use MySQL in different environments and to use MySQL together with other 
# database servers.
sql-mode="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"

# General and Slow logging.
log-output=FILE

general-log=0

general_log_file="DESKTOP-F30O1GF.log"

slow-query-log=1

slow_query_log_file="DESKTOP-F30O1GF-slow.log"

long_query_time=10

# Error Logging.
log-error="DESKTOP-F30O1GF.err"

# ***** Group Replication Related *****
# Specifies the base name to use for binary log files. With binary logging
# enabled, the server logs all statements that change data to the binary
# log, which is used for backup and replication.
log-bin="DESKTOP-F30O1GF-bin"

# ***** Group Replication Related *****
# Specifies the server ID. For servers that are used in a replication topology,
# you must specify a unique server ID for each replication server, in the
# range from 1 to 2^32 − 1. “Unique” means that each ID must be different
# from every other ID in use by any other source or replica.
server-id=1

# Indicates how table and database names are stored on disk and used in MySQL.
# Value 0 = Table and database names are stored on disk using the lettercase specified in the CREATE 
#           TABLE or CREATE DATABASE statement. Name comparisons are case-sensitive. You should not 
#           set this variable to 0 if you are running MySQL on a system that has case-insensitive file 
#           names (such as Windows or macOS). If you force this variable to 0 with 
#           --lower-case-table-names=0 on a case-insensitive file system and access MyISAM tablenames 
#           using different lettercases, index corruption may result.
# Value 1 = Table names are stored in lowercase on disk and name comparisons are not case-sensitive. 
#           MySQL converts all table names to lowercase on storage and lookup. This behavior also applies 
#           to database names and table aliases.
# Value 2 = Table and database names are stored on disk using the lettercase specified in the CREATE TABLE 
#           or CREATE DATABASE statement, but MySQL converts them to lowercase on lookup. Name comparisons 
#           are not case-sensitive. This works only on file systems that are not case-sensitive! InnoDB 
#           table names and view names are stored in lowercase, as for lower_case_table_names=1.
lower_case_table_names=1

# This variable is used to limit the effect of data import and export operations, such as 
# those performed by the LOAD DATA and SELECT ... INTO OUTFILE statements and the 
# LOAD_FILE() function. These operations are permitted only to users who have the FILE privilege.
secure-file-priv="C:/ProgramData/MySQL/MySQL Server 8.0/Uploads"

# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections=151

# The number of open tables for all threads. Increasing this value increases the number 
# of file descriptors that mysqld requires.
table_open_cache=4000

# Defines the maximum amount of memory that can be occupied by the TempTable 
# storage engine before it starts storing data on disk.
temptable_max_ram=1G

# Defines the maximum size of internal in-memory temporary tables created 
# by the MEMORY storage engine and, as of MySQL 8.0.28, the TempTable storage 
# engine. If an internal in-memory temporary table exceeds this size, it is 
# automatically converted to an on-disk internal temporary table.
tmp_table_size=71M

# The storage engine for in-memory internal temporary tables (see Section 8.4.4, “Internal 
# Temporary Table Use in MySQL”). Permitted values are TempTable (the default) and MEMORY.
internal_tmp_mem_storage_engine=TempTable

#*** MyISAM Specific options
# The maximum size of the temporary file that MySQL is permitted to use while re-creating a 
# MyISAM index (during REPAIR TABLE, ALTER TABLE, or LOAD DATA). If the file size would be 
# larger than this value, the index is created using the key cache instead, which is slower. 
# The value is given in bytes.
myisam_max_sort_file_size=2146435072

# The size of the buffer that is allocated when sorting MyISAM indexes during a REPAIR TABLE 
# or when creating indexes with CREATE INDEX or ALTER TABLE.
myisam_sort_buffer_size=133M

# Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than 30% of your available memory, as some memory
# is also required by the OS to cache rows. Even if you're not using
# MyISAM tables, you should still set it to 8-64M as it will also be
# used for internal temporary disk tables.
key_buffer_size=8M

# Each thread that does a sequential scan for a MyISAM table allocates a buffer 
# of this size (in bytes) for each table it scans. If you do many sequential 
# scans, you might want to increase this value, which defaults to 131072. The 
# value of this variable should be a multiple of 4KB. If it is set to a value 
# that is not a multiple of 4KB, its value is rounded down to the nearest multiple 
# of 4KB.
read_buffer_size=128K

# This variable is used for reads from MyISAM tables, and, for any storage engine, 
# for Multi-Range Read optimization.
read_rnd_buffer_size=256K

#*** INNODB Specific options ***
# innodb_data_home_dir=

# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
# skip-innodb

# If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit=1

# The size in bytes of the buffer that InnoDB uses to write to the log files on 
# disk. The default value changed from 8MB to 16MB with the introduction of 32KB 
# and 64KB innodb_page_size values. A large log buffer enables large transactions 
# to run without the need to write the log to disk before the transactions commit. 
# Thus, if you have transactions that update, insert, or delete many rows, making 
# the log buffer larger saves disk I/O.
innodb_log_buffer_size=16M

# The size in bytes of the buffer pool, the memory area where InnoDB caches table 
# and index data. The default value is 134217728 bytes (128MB). The maximum value 
# depends on the CPU architecture; the maximum is 4294967295 (232-1) on 32-bit systems 
# and 18446744073709551615 (264-1) on 64-bit systems. On 32-bit systems, the CPU 
# architecture and operating system may impose a lower practical maximum size than the 
# stated maximum. When the size of the buffer pool is greater than 1GB, setting 
# innodb_buffer_pool_instances to a value greater than 1 can improve the scalability on 
# a busy server.
innodb_buffer_pool_size=128M

# Defines the amount of disk space occupied by redo log files. This variable supersedes the 
# innodb_log_files_in_group and innodb_log_file_size variables. 
innodb_redo_log_capacity=100M

# Defines the maximum number of threads permitted inside of InnoDB. A value 
# of 0 (the default) is interpreted as infinite concurrency (no limit). This 
# variable is intended for performance tuning on high concurrency systems.
# InnoDB tries to keep the number of threads inside InnoDB less than or equal to 
# the innodb_thread_concurrency limit. Once the limit is reached, additional threads 
# are placed into a “First In, First Out” (FIFO) queue for waiting threads. Threads 
# waiting for locks are not counted in the number of concurrently executing threads.
innodb_thread_concurrency=17

# The increment size (in MB) for extending the size of an auto-extend InnoDB system tablespace file when it becomes full.
innodb_autoextend_increment=64

# The number of regions that the InnoDB buffer pool is divided into.
# For systems with buffer pools in the multi-gigabyte range, dividing the buffer pool into separate instances can improve concurrency,
# by reducing contention as different threads read and write to cached pages.
innodb_buffer_pool_instances=8

# Determines the number of threads that can enter InnoDB concurrently.
innodb_concurrency_tickets=5000

# Specifies how long in milliseconds (ms) a block inserted into the old sublist must stay there after its first access before
# it can be moved to the new sublist.
innodb_old_blocks_time=1000

# When this variable is enabled, InnoDB updates statistics during metadata statements.
innodb_stats_on_metadata=0

# When innodb_file_per_table is enabled (the default in 5.6.6 and higher), InnoDB stores the data and indexes for each newly created table
# in a separate .ibd file, rather than in the system tablespace.
innodb_file_per_table=1

# Use the following list of values: 0 for crc32, 1 for strict_crc32, 2 for innodb, 3 for strict_innodb, 4 for none, 5 for strict_none.
innodb_checksum_algorithm=0

# If this is set to a nonzero value, all tables are closed every flush_time seconds to free up resources and
# synchronize unflushed data to disk.
# This option is best used only on systems with minimal resources.
flush_time=0

# The minimum size of the buffer that is used for plain index scans, range index scans, and joins that do not use
# indexes and thus perform full table scans.
join_buffer_size=256K

# The maximum size of one packet or any generated or intermediate string, or any parameter sent by the
# mysql_stmt_send_long_data() C API function.
max_allowed_packet=64M

# If more than this many successive connection requests from a host are interrupted without a successful connection,
# the server blocks that host from performing further connections.
max_connect_errors=100

# The number of file descriptors available to mysqld from the operating system
# Try increasing the value of this option if mysqld gives the error "Too many open files".
open_files_limit=8161

# If you see many sort_merge_passes per second in SHOW GLOBAL STATUS output, you can consider increasing the
# sort_buffer_size value to speed up ORDER BY or GROUP BY operations that cannot be improved with query optimization
# or improved indexing.
sort_buffer_size=256K

# Specify the maximum size of a row-based binary log event, in bytes.
# Rows are grouped into events smaller than this size if possible. The value should be a multiple of 256.
binlog_row_event_max_size=8K


# If the value of this variable is greater than 0, a replica synchronizes its master.info file to disk.
# (using fdatasync()) after every sync_source_info events.
sync_source_info=10000

# If the value of this variable is greater than 0, the MySQL server synchronizes its relay log to disk.
# (using fdatasync()) after every sync_relay_log writes to the relay log.
sync_relay_log=10000

# If the value of this variable is greater than 0, a replica synchronizes its relay-log.info file to disk.
# (using fdatasync()) after every sync_relay_log_info transactions.
sync_relay_log_info=10000

# Load mysql plugins at start."plugin_x ; plugin_y".
# plugin_load

# The TCP/IP Port the MySQL Server X Protocol will listen on.
loose_mysqlx_port=33060

二、由原版逐字翻译成的中文版(行行对应)

# 其他默认调整值
# MySQL Server实例配置文件
# ----------------------------------------------------------------------
# 由MySQL Server实例配置向导生成
#
#
# 安装说明
# ----------------------------------------------------------------------
#
# 在Linux上,您可以将此文件复制到/etc/my.cnf以设置全局选项,
# mysql-data-dir/my.cnf设置服务器特定选项
# (用于此安装的@localstatedir@)或
# ~/.my.cnf设置特定于用户的选项。
#
# 在Windows上,当使用MySQL安装程序安装MySQL时
# 应该将此文件保存在服务器的ProgramData目录中
# (例如C:\ProgramData\MySQL\MySQL-Server X.Y)。为了确保服务器
# 读取配置文件,使用启动选项“--defaults file”。
#
# 要从命令行运行服务器,请在
# 命令行shell,例如。
# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# 若要手动将服务器作为Windows服务安装,请在
# 命令行shell,例如。
# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"
#
# 然后在命令行shell中执行此操作以启动服务器,例如。
# net启动MySQLXY
#
#
# 编辑此文件的准则
# ----------------------------------------------------------------------
#
# 在此文件中,您可以使用程序支持的所有长选项。
# 如果您想知道程序支持的选项,请启动该程序
# 使用“--help”选项。
#
# 有关各个选项的更详细信息也可以
# 在手册中找到。
#
# 有关如何更改设置的建议,请参阅
# https://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
#
#
# 客户块
# ----------------------------------------------------------------------
#
# MySQL客户端应用程序将读取以下选项。
# 请注意,只有MySQL提供的客户端应用程序才有保证
# 阅读本节。如果您希望自己的MySQL客户端程序
# 遵守这些值,您需要在
# MySQL客户端库初始化。
#
[client]

# pipe=

# socket=MYSQL

port=3306

[mysql]
no-beep

# default-character-set=

# 服务器部分
# ----------------------------------------------------------------------
#
# MySQL Server将读取以下选项。确保
# 您已经正确安装了服务器(请参阅上文),因此它会读取以下内容
# 文件。
#
# server_type=3
[mysqld]

# 以下三个选项对SERVER_PORT来说是互斥的。
# skip-networking
# enable-named-pipe
# shared-memory

# shared-memory-base-name=MYSQL

# MySQL服务器将使用的管道。
# socket=MYSQL

# 在MySQL Server创建的命名管道上授予客户端的访问控制。
# named-pipe-full-access-group=

# MySQL服务器将侦听的TCP/IP端口
port=3306

# 安装目录的路径。所有路径通常都相对于此进行解析。
# basedir="C:/Program Files/MySQL/MySQL Server 8.0/"

# 数据库根目录的路径
datadir=C:/ProgramData/MySQL/MySQL Server 8.0\Data

# 当新架构或表
# 已创建,但未定义字符集
# character-set-server=


# 管理多因素身份验证(MFA)功能。它适用于身份验证
# 用于管理MySQL帐户的CREATE USER和ALTER USER语句的因子相关子句
# 定义,其中“factor”对应于关联的身份验证方法或插件
# 有账户。
authentication_policy=*,,

# 在以下情况下创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

# 当前服务器SQL模式,可以动态设置。
# 模式会影响MySQL支持的SQL语法及其执行的数据验证检查。这
# 使MySQL更容易在不同的环境中使用,并更容易与其他环境一起使用
# 数据库服务器。
sql-mode="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"

# 常规和慢速日志记录。
log-output=FILE

general-log=0

general_log_file="DESKTOP-F30O1GF.log"

slow-query-log=1

slow_query_log_file="DESKTOP-F30O1GF-slow.log"

long_query_time=10

# 错误日志记录。
log-error="DESKTOP-F30O1GF.err"

# ***** 与组复制相关 *****
# 指定要用于二进制日志文件的基本名称。使用二进制日志记录
# 启用后,服务器会记录所有将数据更改为二进制的语句
# 日志,用于备份和复制。
log-bin="DESKTOP-F30O1GF-bin"

# ***** 与组复制相关 *****
# 指定服务器ID。对于复制拓扑中使用的服务器,
# 必须在中为每个复制服务器指定一个唯一的服务器ID
# 范围从1到2^32−1。“唯一”表示每个ID必须不同
# 来自任何其他源或复制副本正在使用的每个其他ID。
server-id=1

# 指示表和数据库名称如何存储在磁盘上并在MySQL中使用。
# Value 0 = 表和数据库名称使用CREATE中指定的字母大小写存储在磁盘上
#           TABLE或CREATE DATABASE语句。名称比较区分大小写。你不应该
#           如果您在具有不区分大小写文件的系统上运行MySQL,请将该变量设置为0 
#           名称(如Windows或macOS)。如果使用强制此变量为0
#           --在不区分大小写的文件系统上,小写表名=0,并访问MyISAM表名
#           使用不同的信纸,可能会导致索引损坏。
# Value 1 = 表名以小写形式存储在磁盘上,名称比较不区分大小写。
#           MySQL在存储和查找时将所有表名转换为小写。此行为也适用
#           到数据库名称和表别名。
# Value 2 = 表和数据库名称使用CREATE Table中指定的字母大小写存储在磁盘上
#           或CREATE DATABASE语句,但MySQL在查找时会将它们转换为小写。名称比较
#           不区分大小写。这只适用于不区分大小写的文件系统!创新数据库
#           表名和视图名以小写形式存储,例如lower_case_table_names=1。
lower_case_table_names=1

# 此变量用于限制数据导入和导出操作的效果,例如
# 由LOAD DATA和SELECT…执行。。。INTO OUTFILE语句和
# LOAD_FILE()函数。这些操作仅允许具有FILE权限的用户执行。
secure-file-priv="C:/ProgramData/MySQL/MySQL Server 8.0/Uploads"

# MySQL服务器将执行的最大并发会话数
# 允许其中一个连接将保留给具有
# 允许管理员登录的超级权限,即使
# 已达到连接限制。
max_connections=151

# 所有线程打开的表数。增加该值会增加数字
# mysqld所需的文件描述符的数量。
table_open_cache=4000

# 定义TempTable可以占用的最大内存量
# 存储引擎在开始将数据存储在磁盘上之前。
temptable_max_ram=1G

# 定义创建的内部内存临时表的最大大小
# 通过MEMORY存储引擎,以及从MySQL 8.0.28起的TempTable存储
# 发动机如果内存中的内部临时表超过此大小,则为
# 自动转换为磁盘上的内部临时表。
tmp_table_size=71M

# 内存内部临时表的存储引擎(参见第8.4.4节“内部
# MySQL中的临时表使用”)。允许的值为TempTable(默认值)和MEMORY。
internal_tmp_mem_storage_engine=TempTable

#*** MyISAM特定选项
# MySQL在重新创建时允许使用的临时文件的最大大小
# MyISAM索引(在REPAIR TABLE、ALTER TABLE或LOAD DATA期间)。如果文件大小为
# 如果大于该值,则使用键缓存来创建索引,这会比较慢。
# 该值以字节为单位。
myisam_max_sort_file_size=2146435072

# 在REPAIR TABLE期间对MyISAM索引进行排序时分配的缓冲区大小
# 或者使用CREATE INDEX或ALTER TABLE创建索引时。
myisam_sort_buffer_size=133M

# 密钥缓冲区的大小,用于缓存MyISAM表的索引块。
# 不要将其设置为大于可用内存的30%,作为某些内存
# 也是OS缓存行所需要的。即使你不使用
# MyISAM表,您仍然应该将其设置为8-64M,因为它也将是
# 用于内部临时磁盘表。
key_buffer_size=8M

# 对MyISAM表进行顺序扫描的每个线程都会分配一个缓冲区
# 它扫描的每个表的大小(以字节为单位)。如果你做许多连续的
# 扫描时,您可能希望增加此值,默认值为131072。这个
# 这个变量的值应该是4KB的倍数。如果设置为某个值
# 不是4KB的倍数,其值四舍五入到最接近的倍数
# 高达4KB。
read_buffer_size=128K

# 此变量用于从MyISAM表中读取,对于任何存储引擎,
# 用于多范围读取优化。
read_rnd_buffer_size=256K

#*** INNODB特定选项 ***
# innodb_data_home_dir=

# 如果您的MySQL服务器已启用InnoDB支持,请使用此选项
# 但您不打算使用它。这将节省内存和磁盘空间
# 并且加快一些事情。
# skip-innodb

# 如果设置为1,InnoDB将把事务日志刷新(fsync)到
# 磁盘,这提供了完整的ACID行为。如果你是
# 愿意在安全问题上妥协,而你却跑得很小
# 事务,您可以将其设置为0或2以将磁盘I/O减少到
# 日志。值0表示日志仅写入日志文件,并且
# 日志文件大约每秒刷新一次。值2
# 意味着每次提交时都会将日志写入日志文件,但日志
# 文件大约每秒只将文件刷新到磁盘一次。
innodb_flush_log_at_trx_commit=1

# InnoDB用于写入日志文件的缓冲区的大小(以字节为单位)
# 磁盘随着32KB的引入,默认值从8MB更改为16MB
# 和64KB的innodb_ page_ size值。大型日志缓冲区可实现大型事务
# 在事务提交之前无需将日志写入磁盘即可运行。
# 因此,如果您有更新、插入或删除许多行的事务
# 日志缓冲区越大,节省磁盘I/O。
innodb_log_buffer_size=16M

# 缓冲池的大小(以字节为单位),InnoDB缓存表的内存区域
# 以及索引数据。默认值为134217728字节(128MB)。最大值
# 取决于CPU架构;在32位系统上,最大值为4294967295(232-1)
# 以及在64位系统上的18446744073709551615(264-1)。在32位系统上,CPU
# 体系结构和操作系统可以施加比
# 规定的最大值。当缓冲池的大小大于1GB时,设置
# innodb_buffer_pool_instances的值大于1可以提高上的可伸缩性
# 繁忙的服务器。
innodb_buffer_pool_size=128M

# 定义重做日志文件所占用的磁盘空间量。此变量取代
# innodb_log_files_i_group和innodb_og_file_size变量。
innodb_redo_log_capacity=100M

# 定义InnoDB内部允许的最大线程数。A值
# 0的(默认值)被解释为无限并发(无限制)。这
# 变量用于高并发系统上的性能调优。
# InnoDB试图保持InnoDB内部的线程数小于或等于
# innodb_thread_concurrency限制。一旦达到极限,就会有额外的线程
# 被放入等待线程的“先进先出”(FIFO)队列中。线程
# 等待锁不计入并发执行的线程数。
innodb_thread_concurrency=17

# 当自动扩展InnoDB系统表空间文件变满时,用于扩展其大小的增量大小(MB)。
innodb_autoextend_increment=64

# InnoDB缓冲池被划分为的区域数。
# 对于缓冲池在千兆字节范围内的系统,将缓冲池划分为单独的实例可以提高并发性,
# 通过减少不同线程读取和写入缓存页面时的争用。
innodb_buffer_pool_instances=8

# 确定可以同时进入InnoDB的线程数。
innodb_concurrency_tickets=5000

# 指定插入到旧子列表中的块在其第一次访问之后必须停留在那里的时间(以毫秒为单位)
# 可以将其移动到新的子列表中。
innodb_old_blocks_time=1000

# 当启用该变量时,InnoDB会在元数据语句期间更新统计信息。
innodb_stats_on_metadata=0

# 当innodb_file_per_table被启用时(5.6.6及更高版本中的默认值),innodb存储每个新创建的表的数据和索引
# 在一个单独的.ibd文件中,而不是在系统表空间中。
innodb_file_per_table=1

# 使用以下值列表:0表示crc32,1表示strict_crc32,2表示innodb,3表示strict_innodb,4表示none,5表示strict_none。
innodb_checksum_algorithm=0

# 如果将其设置为非零值,则每flush_time秒关闭所有表以释放资源和
# 将未刷新的数据同步到磁盘。
# 此选项最好仅用于资源最少的系统。
flush_time=0

# 用于普通索引扫描、范围索引扫描和不使用的联接的缓冲区的最小大小
# 索引,从而执行全表扫描。
join_buffer_size=256K

# 一个数据包或任何生成或中间字符串的最大大小,或由
# mysql_stmt_send_long_data()C API函数。
max_allowed_packet=64M

# 如果在没有成功连接的情况下中断了来自主机的超过这个数量的连续连接请求,
# 服务器阻止该主机执行进一步的连接。
max_connect_errors=100

# 操作系统中可用于mysqld的文件描述符数
# 如果mysqld给出错误“打开的文件太多”,请尝试增加此选项的值。
open_files_limit=8161

# 如果在SHOW GLOBAL STATUS输出中每秒看到许多sort_merge_passes,可以考虑增加
# sort_buffer_size值以加快查询优化无法改进的ORDER BY或GROUP BY操作
# 或改进的索引。
sort_buffer_size=256K

# 指定基于行的二进制日志事件的最大大小(以字节为单位)。
# 如果可能,行被分组为小于此大小的事件。该值应该是256的倍数。
binlog_row_event_max_size=8K


# 如果此变量的值大于0,则副本会将其master.info文件同步到磁盘。
# (using fdatasync()) after every sync_source_info events.
sync_source_info=10000

# 如果此变量的值大于0,MySQL服务器会将其中继日志同步到磁盘。
# (using fdatasync()) after every sync_relay_log writes to the relay log.
sync_relay_log=10000

# 如果此变量的值大于0,则复制副本会将其relay-log.info文件同步到磁盘。
# (using fdatasync()) after every sync_relay_log_info transactions.
sync_relay_log_info=10000

# 一开始就加载mysql插件。“插入_x;插入_y”。
# plugin_load

# MySQL Server X协议将侦听的TCP/IP端口。
loose_mysqlx_port=33060

三、最常用的配置


网站公告

今日签到

点亮在社区的每一天
去签到