我根据MySQL配置文件的英文文档说明,在根据自己所学的知识,使用有道词典对不懂的单词进行了查询,一个一个翻译出来的。有的专业术语翻译的不好,我使用了英文进行标注,例如主机(master)和副机(slave hosts),不知道如何翻译,所有在翻译后面加上了英文标识。
下面是这个MySQL的my-innodb-heavy-4G.ini配置文件的中英对照版,如果有些地方解释的不对,希望大神可以指正。
所有以"注:"开头的都是翻译部分。
#BEGIN CONFIG INFO
#DESCR: 4GB RAM, InnoDB only, ACID, few connections, heavy queries
#TYPE: SYSTEM
#END CONFIG INFO #注:这个用于4G的内存,并且只能用于InnoDB模式,支持事务的ACID,很少的连接数,很大的查询数 #
# This is a MySQL example config file for systems with 4GB of memory
# running mostly MySQL using InnoDB only tables and performing complex
# queries with few connections.
# #注:这是MySQL的一个样例的配置文件,要求系统有至少4G的内存,运行MySQL使用InnoDB模式运行复杂的连接但是连接数较少 # MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html #注:MySQL程序将会寻找参数(配置)文件在一系列的地方,这个依赖MySQL的运行的平台和安装情况,你可以复制这些文件
#到MySQL查找配置的文件的路径。如果你想知道更多的信息,可以参考: http://dev.mysql.com/doc/mysql/en/option-files.html # In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# #注:在这个配置文件中,你可以使用所有被MySQL程序支持的长参数,如果你想知道有那些参数被MySQL支持,你可以使用如下命令
# mysql --help 或者 man mysql-5.1./support-files/my-innodb-heavy-4G.cnf # More detailed information about the individual options can also be
# found in the manual.
# #注:更多详细的信息关于个别的参数可以参考参考手册 #
# 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.
# #注:接下来的参数将会被MySQL客户端应用读取。记住只有那些被MySQL服务端授权的客户端才会保证去读取到这些参数
#如果你想让你自己的MySQL客户端去读取这些参数,你需要指定这个作为一个选项在你的MySQL客户端lib库初始化的时候 [client] #客户端参数配置
#password = [your_password] #你自己的密码
port = #数据库的端口为3306
socket = /application/mysql5.1.72/tmp/mysql.sock #指定socket路径,我也不知道什么意思 # *** Application-specific options follow here *** #注下面是MySQL服务端参数配置 #
# The MySQL server
#
[mysqld] # generic configuration options
port = #数据库服务端端口为3306
socket = /application/mysql5.1.72/tmp/mysql.sock #指定socket路径 # back_log is the number of connections the operating system can keep in
# the listen queue, before the MySQL connection manager thread has
# processed them. If you have a very high connection rate and experience
# "connection refused" errors, you might need to increase this value.
# Check your OS documentation for the maximum value of this parameter.
# Attempting to set back_log higher than your operating system limit
# will have no effect.
back_log = #注:back_log 是一个数值,在数据库连接管理器处理这些队列之前,操作系统可以保持监听队列的数量。
#如果你的数据库服务有一个很高的连接数并且有连接拒绝的经历,你可以增大这个值。你需要检查你的操作系统
#的文件系统对这个参数的最大支持。如果你设定的值超过操作系统的最大值,那么这个值将无效 # Don't listen on a TCP/IP port at all. This can be a security
# enhancement, if all processes that need to connect to mysqld run
# on the same host. All interaction with mysqld must be made via Unix
# sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#skip-networking #注:skip-networking 这个参数是一个属性,没有值。把注解去掉即生效。这个参数的用途为:
#不监听TCP/IP的端口。这是一个增加安全的参数,如果所有的连接MySQL的程序都来自相同的主机。
#这样,所有与MySQL服务器的连接都需要在通道或者管道中进行
#记住:使用这个参数不能使用管道早Windows中 # 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 = #注:MySQL允许的最大连接数。在这些连接中,始终会为超级管理员保留一个连接,即使所有的连接已经达到上限 # Maximum amount of errors allowed per host. If this limit is reached,
# the host will be blocked from connecting to the MySQL server until
# "FLUSH HOSTS" has been run or the server was restarted. Invalid
# passwords and other errors during the connect phase result in
# increasing this value. See the "Aborted_connects" status variable for
# global counter.
max_connect_errors = #注:每个客户端运行的最大的错误数。如果错误的数量到达上限,这个客户端将会被阻塞去连接数据库直到刷新客户端
#或者重新启动服务器。无效的密码或者其他的连接错误都算作错误,会增加这个值。可以参考Aborted_connects的状态
#来查看全局的计数器 # The number of open tables for all threads. Increasing this value
# increases the number of file descriptors that mysqld requires.
# Therefore you have to make sure to set the amount of open files
# allowed to at least in the variable "open-files-limit" in
# section [mysqld_safe]
table_open_cache = #注:这个值代表着所有对外开放的数据表的数量。增加这个值将会增加MySQL所需要的文件描述符
#因此你需要去设置"open-files-limit"的值至少为4096在MySQL安全的配置文件中,你可以看到这个值在本文的最后 # Enable external file level locking. Enabled file locking will have a
# negative impact on performance, so only use it in case you have
# multiple database instances running on the same files (note some
# restrictions still apply!) or if you use other software relying on
# locking MyISAM tables on file level.
#external-locking #注:external-locking为外部文件锁的意思,可用的外部文件锁。如果使用外部文件锁将会对MySQL的性能有消极影响。
#因此使用外部文件锁当你有多重的数据库实例运行在相同的文件中(记住一些限制任然是有用的)或者可用使用一些依赖MyISAM的外部锁软件 # The maximum size of a query packet the server can handle as well as
# maximum query size server can process (Important when working with
# large BLOBs). enlarged dynamically, for each connection.
max_allowed_packet = 16M #注:MySQL查询包的最大值或者是处理查询的最大值,(这个属性非常重要,如果你操作很大的二进制对象的数据的时候)
#这个值可以对每个线程进行动态的扩大 # The size of the cache to hold the SQL statements for the binary log
# during a transaction. If you often use big, multi-statement
# transactions you can increase this value to get more performance. All
# statements from transactions are buffered in the binary log cache and
# are being written to the binary log at once after the COMMIT. If the
# transaction is larger than this value, temporary file on disk is used
# instead. This buffer is allocated per connection on first update
# statement in transaction
binlog_cache_size = 1M #注:binlog_cache_size 是一个缓存大小的值,这个是用于存放在事务中,用于存储SQL statement的日志
#如果你经常使用大的、多statement的事务,你可以增加这个值去获取更多的性能。
#所有和事务相关的statement都会以二进制的形式写入该缓冲区,并且都会立刻写入二进制日志在事务提交以后
#如果事务的数据量超过这个值,在磁盘上就会建立临时文件来使用。
#这个缓冲区将会开启在每个连接第一次进行update操作的时候 # Maximum allowed size for a single HEAP (in memory) table. This option
# is a protection against the accidential creation of a very large HEAP
# table which could otherwise use up all memory resources.
max_heap_table_size = 64M #注:max_heap_table_size是一个最大限制值,限制一个单独的数据表在内存里面的堆积的最大值
#有了此限制,就不会让表数据把内存堆满 # Size of the buffer used for doing full table scans.
# Allocated per thread, if a full scan is needed.
read_buffer_size = 2M #read_buffer_size 是一个数据表视图全部显示的缓存大小,允许每个线程去使用此缓存 # When reading rows in sorted order after a sort, the rows are read
# through this buffer to avoid disk seeks. You can improve ORDER BY
# performance a lot, if set this to a high value.
# Allocated per thread, when needed.
read_rnd_buffer_size = 16M #read_rnd_buffer_size 是一个按顺序读取的缓存大小,在读取数据过程中,我们可能先对数据排序,排序好的数据会先放在此缓冲区中。
#然后在进行读取,避免在一次进行磁盘查找。增加这个值可以提升 ORDER BY 语句的性能。允许每个线程使用 # Sort buffer is used to perform sorts for some ORDER BY and GROUP BY
# queries. If sorted data does not fit into the sort buffer, a disk
# based merge sort is used instead - See the "Sort_merge_passes"
# status variable. Allocated per thread if sort is needed.
sort_buffer_size = 8M #sort_buffer_size 是分类或者排序缓存的大小,用于去执行分类/排序语句,如 ORDER BY and GROUP BY
#如果实际的数据过大超过这个缓冲区,那么基于磁盘的分类合并将会被使用。
#允许每个线程 # This buffer is used for the optimization of full JOINs (JOINs without
# indexes). Such JOINs are very bad for performance in most cases
# anyway, but setting this variable to a large value reduces the
# performance impact. See the "Select_full_join" status variable for a
# count of full JOINs. Allocated per thread if full join is found
join_buffer_size = 8M #join_buffer_size 是一个内连接的缓存,用于优化内连接操作。我们知道,内连接对性能是有非常坏的影响的
#但是设置内连接缓存将会减少内连接对性能的消极影响。查看 "Select_full_join"可以知道有多少内连接操作 # How many threads we should keep in a cache for reuse. When a client
# disconnects, the client's threads are put in the cache if there aren't
# more than thread_cache_size threads from before. This greatly reduces
# the amount of thread creations needed if you have a lot of new
# connections. (Normally this doesn't give a notable performance
# improvement if you have a good thread implementation.)
thread_cache_size = #注:thread_cache_size是数据库服务端的连接线程在线程池中保持活跃的上限。当客户端不连接数据库的时候
#这个客户端的连接线程将会保持在线程池里面如果线程中的总线程数量不超过 "thread_cache_size"给定的值
#这个将会减少线程的创建当有很多新的连接突然来到的时候。(正常情况下,这个参数将不会给数据库性能带来不稳定的提升
#如果你有一个很好的线程实现) # This permits the application to give the threads system a hint for the
# desired number of threads that should be run at the same time. This
# value only makes sense on systems that support the thread_concurrency()
# function call (Sun Solaris, for example).
# You should try [number of CPUs]*(..) for thread_concurrency
thread_concurrency = #注:thread_concurrency 是一个线程并发的数量的参考值。这个应用去给线程系统一个暗示关于希望多少个线程可以使用
#在相同的时间内。这个值只是做一个参考在支持thread_concurrency()在(Sun Solaris 的操作系统中)
#说白了就是我们CPU的线程数,如2线程,4线程 # Query cache is used to cache SELECT results and later return them
# without actual executing the same query once again. Having the query
# cache enabled may result in significant speed improvements, if your
# have a lot of identical queries and rarely changing tables. See the
# "Qcache_lowmem_prunes" status variable to check if the current value
# is high enough for your load.
# Note: In case your tables change very often or if your queries are
# textually different every time, the query cache may result in a
# slowdown instead of a performance improvement.
query_cache_size = 64M #注:query_cache_size 是查询缓存的大小。如果你执行一次查询,数据库会把查询的结果放入缓存中
#如果你以后执行了同以前相同的查询,那么数据库会直接从缓存中返回数据(前提是有以前的缓存数据)
#如果你经常查询同一张表或者经常查询相同的大数据,这个缓存将会帮你提升性能
#如果你的查询是多变的,并且每次都不一样,那么这个缓冲区可能会降低你的性能 # Only cache result sets that are smaller than this limit. This is to
# protect the query cache of a very large result set overwriting all
# other query results.
query_cache_limit = 2M #注:query_cache_limit 查询缓存的最小值,只有当 query_cache_size 的设置小于 query_cache_limit
#才会生效。设置这个值是为了避免查询缓存过小,而一个大数据的查询会把所有的查询缓存覆盖 # Minimum word length to be indexed by the full text search index.
# You might wish to decrease it if you need to search for shorter words.
# Note that you need to rebuild your FULLTEXT index, after you have
# modified this value.
ft_min_word_len = #ft_min_word_len 是被编入数据库索引单词的最小长度。你可能想去减少这个长度如果你想查询更短的单词的时候
#那你就需要重新编译 FULLTEXT 在你修改这个值之后 # If your system supports the memlock() function call, you might want to
# enable this option while running MySQL to keep it locked in memory and
# to avoid potential swapping out in case of high memory pressure. Good
# for performance.
#memlock #memlock 是内存锁的参数。所谓的内存锁就是在运行MySQL的时候指定就在某个内存范围内运行
#这样就避免高端内存的交换,对性能有提升。但是这是参数需要操作系统的支持,默认关闭此参数 # Table type which is used by default when creating new tables, if not
# specified differently during the CREATE TABLE statement.
default-storage-engine = MYISAM #注: default-storage-engine,默认的存储引擎参数,在MySQL中,mysql中用的最多存储引擎就是innodb和 myisam
#这里使用的默认存在引擎为myisam # Thread stack size to use. This amount of memory is always reserved at
# connection time. MySQL itself usually needs no more than 64K of
# memory, while if you use your own stack hungry UDF functions or your
# OS requires more stack for some operations, you might need to set this
# to a higher value.
thread_stack = 192K #注:thread_stack线程堆栈的大小。这个值将会被保留在内存中当在连接的时候,MySQL自身需要的线程
#堆栈不超过64K,然而当你自己的定义的UDF(User define Function 用户自定义函数)或者是你的操作
#系统需要更多的堆栈对一些操作,你可能需要去提高这个值 # Set the default transaction isolation level. Levels available are:
# READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
transaction_isolation = REPEATABLE-READ #注:transaction_isolation 设置MySQL事务的隔离级别,这里设置的是REPEATABLE-READ(可重复的读)
#此外MySQL还有额外的事务隔离机制 READ-UNCOMMITTED(脏读) READ-COMMITTED(读已提交) SERIALIZABLE(串行化) # Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them.
tmp_table_size = 64M #注 tmp_table_size 是限制一直数据表临时在内存中的最大存储容量,如果超过了这个值,那么将自动的转为磁盘存储
#这个限制只作用于一个单独的表。 # Enable binary logging. This is required for acting as a MASTER in a
# replication configuration. You also need the binary log if you need
# the ability to do point in time recovery from your latest backup.
log-bin=mysql-bin #注:log-bin是二进制的日志文件。二进制的日志文件被需要当管理员去恢复数据库的配置的时候。
#你会需要二进制日志当你需要恢复数据库从最近的备份 # binary logging format - mixed recommended
binlog_format=mixed # binlog_format 设置上面二进制的日志格式,mixed 格式被推荐使用 # If you're using replication with chained slaves (A->B->C), you need to
# enable this option on server B. It enables logging of updates done by
# the slave thread into the slave's binary log.
#log_slave_updates #注:log_slave_updates 关系型日志更新,如果你使用这样的关系链如(A->B->C),那么你需要把这个参数打开在B机器上
#他可以记录关联机器的(A和C)更新的日志 # Enable the full query log. Every query (even ones with incorrect
# syntax) that the server receives will be logged. This is useful for
# debugging, it is usually disabled in production use.
#log # Print warnings to the error log file. If you have any problem with
# MySQL you should enable logging of warnings and examine the error log
# for possible explanations.
#log_warnings #注:log_warnings 是打印警告对于错误的日志文件,默认被注释掉(关闭的)。如果你任何的问题
#对于MySQL,你应当开启错误日志警告并且测试错误日志得到相应的解释 # Log slow queries. Slow queries are queries which take more than the
# amount of time defined in "long_query_time" or which do not use
# indexes well, if log_short_format is not enabled. It is normally good idea
# to have this turned on if you frequently add new queries to the
# system.
slow_query_log #注:slow_query_log 是开启查询缓慢日志。查询缓慢是那些查询花费的时间超过定义的 "long_query_time" 的查询或者是没有使用索引的查询将会被写如日志
#如果 "log_short_format" 没有开启,正常情况下是非常好的去打开这个控制如果你频繁的增加新的的查询 # All queries taking more than this amount of time (in seconds) will be
# trated as slow. Do not use "" as a value here, as this will result in
# even very fast queries being logged from time to time (as MySQL
# currently measures time with second accuracy only).
long_query_time = #注:long_query_time 是设置查询的最大时间限制,单位:秒
#如果所有的查询时间超过这个时间就会被认为是查询缓慢。不要设置1作为 "long_query_time"的值
#因为这个将会导致系统有时候误认快速查询为慢速查询。(MySQL一般是以秒来作为精确度) # *** Replication related settings #MySQL主从复制原理设置 # Unique server identification number between and ^-. This value
# is required for both master and slave hosts. It defaults to if
# "master-host" is not set, but will MySQL will not function as a master
# if it is omitted.
server-id = #注:server-id 是唯一的服务器标识数在 到 ^-1之间。这个值将会被主机(master)和副机(slave hosts)使用
#server-id将默认会被定义成1如果"master-host"(主从复制的主机,这里的称为主机(master),另一个称为副机(slave host))没有指定,
#那么这个MySQL服务器将不会执行作为主机(master)的功能 # Replication Slave (comment out master section to use this) #注:配置副机(slave host)(添加注释的区域是说明和使用的)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#注:为了去配置这个MySQL作为副机(slave),你可以使用下面两种方案
#
# ) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
# #注:第一种方案:使用 "CHANGE MASTER TO"命令(完整的描述在MySQL的使用手册中)
#"CHANGE MASTER TO"使用的语法及样例你可以参考什么的介绍,说的很详细 # OR
#
# ) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# changes in this file to the variable values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
# #注:第二种方案:设置如下的变量,可是,如果你使用了这种方法,然后首次开启主从复制(即使你失败了,举个例子:如果你误输入主机(master)
#的密码,副机(salve)将不会连接),这个副机将会创建一个master.info文件,之后里面的配置变量在下面的都会失效并且会用
#主机(master)的master.info里面的内容来重写,除非你停止副机(slave),然后删除副机(slave)的master.info文件并且重新启动
#副机(slave)。对于这个理由,你可能立刻想放弃这个方案。使用"CHANGE MASTER TO"命令的方法可以参考什么 # required unique id between and ^ -
# (and different from the master)
# defaults to if master-host is set
# but will not function as a slave if omitted
#server-id = #注:需要唯一的标识数id来标识这是一个副机(slave),不同于主机(master)。默认使用2如果主机(master-host)已经设置为1
#但是如果这个值被遗漏,那么这个副机(slave)就不会执行副机有的功能 #
# The replication master for this slave - required
#master-host = <hostname>
# #注:指定主从复制的主机(master)对于副机(slave),这个是必须的 # The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username> #注:这个主机(master)的用户名被用于副机(slave)连接主机的验证,这个参数是必须的 # The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password> #注:这个主机(master)的密码用于副机(slave)连接主机时候的认证 # The port the master is listening on.
# optional - defaults to
#master-port = <port> #注:这个主机(master)所在的端口,默认为3306 # Make the slave read-only. Only users with the SUPER privilege and the
# replication slave thread will be able to modify data on it. You can
# use this to ensure that no applications will accidently modify data on
# the slave instead of the master
#read_only #注:read_only 数据只读性。使得副机(slave)保持只读的性质。只有拥有超级权限的用户和主从复制的线程才有权限去修改副机(slave)
#你可以使用这个参数去确保没有应用可以去修改副机上面的数据 #以上的这些主从复制参数都被注释掉了,因为这些参数都用于副机(slave),而这里是主机 #*** MyISAM Specific options #使用MyISAM存储引擎的一些特殊的参数 # Size of the Key Buffer, used to cache index blocks for MyISAM tables.
# Do not set it larger than % 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 -64M as it will also be
# used for internal temporary disk tables.
key_buffer_size = 32M #注:key_buffer_size 是索引缓冲区的大小。用于缓存索引区块对于使用MyISAM储存的数据表
#不要设置他的值超过你内存的30%,因为操作系统也需要内存去去缓存行数据。即使你不使用MyISAM存储引擎
#你也需要设置key_buffer_size值为8-64M去用于存放内部的临时数据表 # MyISAM uses special tree-like cache to make bulk inserts (that is,
# INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA
# INFILE) faster. This variable limits the size of the cache tree in
# bytes per thread. Setting it to will disable this optimisation. Do
# not set it larger than "key_buffer_size" for optimal performance.
# This buffer is allocated when a bulk insert is detected.
bulk_insert_buffer_size = 64M #注:bulk_insert_buffer_size 是MyISAM专属的树形缓冲区的大小。这个树形缓冲区主要用于
#存放待插入的数据。bulk_insert_buffer_size将会限制树形缓冲区的大小对于每个线程,如果bulk_insert_buffer_size
#设置为0,那么这个功能将不可用。设置这个值不要超过"key_buffer_size"是最佳性能
#这个缓冲区将会被分配当检测到插入数据的时候 # This buffer is allocated when MySQL needs to rebuild the index in
# REPAIR, OPTIMIZE, ALTER table statements as well as in LOAD DATA INFILE
# into an empty table. It is allocated per thread so be careful with
# large settings.
myisam_sort_buffer_size = 128M # myisam_sort_buffer_size 是一个缓冲区,当MySQL需要重新修建索引在 REPAIR, OPTIMIZE, ALTER 数据表是或者
#插入数据到一个空表中时,会分配这个缓冲区。这个缓冲区将会被分配到每个线程以至于很小心的对于大的设置 # The maximum size of the temporary file MySQL is allowed to use while
# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.
# If the file-size would be bigger than this, the index will be created
# through the key cache (which is slower).
myisam_max_sort_file_size = 10G #注:myisam_max_sort_file_size MySQL最大使用的临时文件大小当重建索引或者修改表或者加载数据时
#如果文件大小超过这个设定的值,那么索引将会被创建在索引缓冲区中(这个行为会比较慢) # If a table has more than one index, MyISAM can use more than one
# thread to repair them by sorting in parallel. This makes sense if you
# have multiple CPUs and plenty of memory.
myisam_repair_threads = #注: myisam_repair_threads 是MyISAM开启的修理线程数量。当一个表有多个索引,MyISAM就会开启一个或者多个
#修理线程去修理这些索引使他们并行的排序。如果想让这个变量有意义,那么你的机器需要有一个很复杂的CPU和大量的内存 # Automatically check and repair not properly closed MyISAM tables.
myisam_recover # myisam_recover 是一个控制,控制是否自动的检查和修理不正确关闭的数据表 # *** INNODB Specific options *** #使用INNODB存储引擎的一些特殊的参数 # 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 #注:使用这参数如果你的MySQL服务支持InnoDB,但是如果你不打算使用它,这个将会节约内存和磁盘空间
#并且加速某些操作 # Additional memory pool that is used by InnoDB to store metadata
# information. If InnoDB requires more memory for this purpose it will
# start to allocate it from the OS. As this is fast enough on most
# recent operating systems, you normally do not need to change this
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size = 16M #注: innodb_additional_mem_pool_size 额外的内存池大小由InnoDB去存储元数据
#如果InnoDB需要更多的内存,他会直接找操作系统去要,这个操作是足够快的对于操作系统
#因此你正常情况下没必要去改变这个值。使用"SHOW INNODB STATUS"命令可以查看当前的
#innodb_additional_mem_pool_size的值 # InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and
# row data. The bigger you set this the less disk I/O is needed to
# access data in tables. On a dedicated database server you may set this
# parameter up to % of the machine physical memory size. Do not set it
# too large, though, because competition of the physical memory may
# cause paging in the operating system. Note that on 32bit systems you
# might be limited to -.5G of user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size = 2G #注:innodb_buffer_pool_size 是InnoDB用来存在索引和数据的缓冲区。InnoDB存储引擎和MyISAM不一样
#InnoDB使用缓存池来缓存索引和行数据。这个值你设置的越大,磁盘I/O消耗的就会越少
#在一个专门用于数据存储的服务器中,你可能设置这个参数的值为内存大小的80%。但是不要设置这个值过大
#因为在和操作系统竞争物理内存的过程中会导致操作系统出现问题。在32位的操作系统中,这个值限制在
#-.5G在用户级别的程序中。总之不要设置这个过大 # InnoDB stores data in one or more data files forming the tablespace.
# If you have a single logical drive for your data, a single
# autoextending file would be good enough. In other cases, a single file
# per device is often a good choice. You can configure InnoDB to use raw
# disk partitions as well - please refer to the manual for more info
# about this.
innodb_data_file_path = ibdata1:10M:autoextend #注: innodb_data_file_path 指定数据文件的路径。InnoDB存储数据使用的是多个数据文件来形成空间表
#如果你有一个额外的逻辑分区来存在你的数据,单个的自填充文件是最好不过了。在另一方面
#一系列简单的文件对于每个驱动来说都是一个好的选择。如果你想知道如何配置InnoDB使用 raw disk partitions
#请参考使用手册 # Set this option if you would like the InnoDB tablespace files to be
# stored in another location. By default this is the MySQL datadir.
#innodb_data_home_dir = <directory> #注: innodb_data_home_dir指定InnoDB数据文件的存在位置。你可以修改这个值来指定
#数据文件的存在路径 # Number of IO threads to use for async IO operations. This value is
# hardcoded to on Unix, but on Windows disk I/O may benefit from a
# larger number.
innodb_file_io_threads = #注:innodb_file_io_threads 异步的IO线程数量对于业务的操作。这个值被写死为4在Unix 或者Linux
#在Windows下面,可以适当增加 # If you run into InnoDB tablespace corruption, setting this to a nonzero
# value will likely help you to dump your tables. Start from value and
# increase it until you're able to dump the table successfully.
#innodb_force_recovery= #注:innodb_force_recovery 是InnoDB空间表的转储情况。如果你运行InnoDB空间表出错
#设置这个值为一个非0的数将会帮助你去转储你的空间表。从1开始增长直到你的数据表转储完成 # Number of threads allowed inside the InnoDB kernel. The optimal value
# depends highly on the application, hardware as well as the OS
# scheduler properties. A too high value may lead to thread thrashing.
innodb_thread_concurrency = #注:innodb_thread_concurrency 指定InnoDB的线程并发数量。这个值允许低于InnoDB的内核
#这个参数的最优值要依赖于具体的应用程序,硬件以及操作系统。太高的设置这个参数值将会导致
#线程超负荷 # If set to , 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 or to reduce disk I/O to the
# logs. Value means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value
# 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 = #注:innodb_flush_log_at_trx_commit 设置事务日志的级别。
#如果设置为1,那么每一次事务提交,就会把事务日志同步到磁盘,这样安全性高,但是占用较多的磁盘I/O
#如果设置为0,日志只会被写入日志文件,并且每隔1s刷新到磁盘,不怎么消耗I/O,但安全性较差
#如果设置为2,每次事务提交就会立刻写入日志文件,但是每隔1s才会同步到磁盘,不怎么消耗I/O,但安全性较差 # Speed up InnoDB shutdown. This will disable InnoDB to do a full purge
# and insert buffer merge on shutdown. It may increase shutdown time a
# lot, but InnoDB will have to do it on the next startup instead.
#innodb_fast_shutdown #注: 加速InnoDB关闭的设置,这个设置将会废除InnoDB做整个数据的检查并且会保存到缓冲区中去
#这个也可能增加InnoDB的关闭时间。但是InnoDB将会去做整个数据检查在下一次开机的时候 # The size of the buffer InnoDB uses for buffering log data. As soon as
# it is full, InnoDB will have to flush it to disk. As it is flushed
# once per second anyway, it does not make sense to have it very large
# (even with long transactions).
innodb_log_buffer_size = 8M #注: innodb_log_buffer_size InnoDB日志缓冲区大小。只要日志缓冲区满了,InnoDB就会刷新日志到磁盘中
#但是因为InnoDB每秒刷新一次日志到磁盘,所以没必要设置这个值太大(即使是很长的事务) # Size of each log file in a log group. You should set the combined size
# of log files to about %-% of your buffer pool size to avoid
# unneeded buffer pool flush activity on log file overwrite. However,
# note that a larger logfile size will increase the time needed for the
# recovery process.
innodb_log_file_size = 256M #注: innodb_log_file_size是在一组日志文件中,每个日志文件的大小。你可以综合设置日志文件的大小
#为 "innodb_buffer_pool_size"(索引和数据缓冲区)大小的25%-% 去避免因日志文件满而进行的刷新重新操作。
#记住如果innodb_log_file_size值过大将会增加恢复进程的处理时间 # Total number of files in the log group. A value of - is usually good
# enough.
innodb_log_files_in_group = #注: innodb_log_files_in_group是每个日志组里面日志的总数量。-3个比较合适 # Location of the InnoDB log files. Default is the MySQL datadir. You
# may wish to point it to a dedicated hard drive or a RAID1 volume for
# improved performance
#innodb_log_group_home_dir #注:InnoDB的日志存储路径。默认为MySQL的datadir。你可能想指定这个路径到一个专用的RAID1设备
#去提高MySQL的性能 # Maximum allowed percentage of dirty pages in the InnoDB buffer pool.
# If it is reached, InnoDB will start flushing them out agressively to
# not run out of clean pages at all. This is a soft limit, not
# guaranteed to be held.
innodb_max_dirty_pages_pct = #注: innodb_max_dirty_pages_pct是InnoDB允许在缓存池内脏页(dirty pages)占的最大比例。如果超出了这个比例
#InnoDB将会去刷新这些脏页(dirty pages)但是不会用光这些干净页(dirty pages).
#这个一个软的限制,不能保证会执行 # The flush method InnoDB will use for Log. The tablespace always uses
# doublewrite flush logic. The default value is "fdatasync", another
# option is "O_DSYNC".
#innodb_flush_method=O_DSYNC #注:InnoDB的日志刷新方式,InnoDB总是使用双向写(doublewrite)的方式来刷新日志。
#默认值是"fdatasync",还有一个值是O_DSYNC。如果想了解更多的日志刷新方式和脏页(dirty pages),
#可以参考下面的链接
http://www.cnblogs.com/cchust/p/3961260.html # How long an InnoDB transaction should wait for a lock to be granted
# before being rolled back. InnoDB automatically detects transaction
# deadlocks in its own lock table and rolls back the transaction. If you
# use the LOCK TABLES command, or other transaction-safe storage engines
# than InnoDB in the same transaction, then a deadlock may arise which
# InnoDB cannot notice. In cases like this the timeout is useful to
# resolve the situation.
innodb_lock_wait_timeout = #注: innodb_lock_wait_timeout是InnoDB锁等待的超时时间。InnoDB将会自动的发现死锁在
#他的锁表中并且会回滚这些事务。如果你使用"LOCK TABLES"命令或者其他事务安全存储引擎
#在同一个事务中,死锁可能使InnoDB连接不敏感,使用这个超时参数会很有用的去解决这个问题 [mysqldump]
# Do not buffer the whole result set in memory before writing it to
# file. Required for dumping very large tables
quick #注:MySQL数据转储。在把数据转储之前,不会缓存整个结果在内存中。适用于转储数据量很大的表 max_allowed_packet = 16M #注:参阅141行 [mysql]
no-auto-rehash #注:MySQL不自动刷新 # Only allow UPDATEs and DELETEs that use keys.
#safe-updates #安全的更新,只允许更新和删除使用索引 [myisamchk]
key_buffer_size = 512M #参考474行
sort_buffer_size = 512M #参考191行
read_buffer = 8M #读缓冲区大小
write_buffer = 8M #写缓冲区大小 [mysqlhotcopy]
interactive-timeout #注:服务器关闭交互式连接前等待活动的秒数。交互式客户端定义为在mysql_real_connect()中使用CLIENT_INTERACTIVE选项的客户端。
#参数默认值:28800秒(8小时) [mysqld_safe]
# Increase the amount of open files allowed per process. Warning: Make
# sure you have set the global system limit high enough! The high value
# is required for a large number of opened tables
open-files-limit = #注:MySQL的安全性参数,开放文件的数量。允许每个进程去增加开放文件的数量
#警告:确保你已经做了全局系统的限制。这个值需要被增大当有大量的开放表被使用的时候。