mysql配置文件-my-innodb-heavy-4G.cnf中文注释

#BEGIN CONFIG INFO
#DESCR: 4GB RAM, InnoDB only, ACID, few connections, heavy queries
#TYPE: SYSTEM
#END CONFIG INFO
#
# 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程序在查询选项文件,依赖于发布平台,选项如--no-defaults,--help这样
# 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.
#
在这个文件里,你可以用所有程序支持的长选项
如果你想知道程序支持哪些选项,运行命令带--help
# 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客户端拥有这些值,
你需要在mysql客户端初始化的时候,把它作为一个选项指定
[client]
#password    = [your_password]
port        = 3306
socket        = /application/mysql-5.5.57/tmp/mysql.sock
# *** Application-specific options follow here ***
#
# The MySQL server
#
[mysqld]
# generic configuration options
#一般配置
port        = 3306
socket        = /application/mysql-5.5.57/tmp/mysql.sock
# 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 是操作系统在MySQL连接管理器线程处理他们之前,
在监听队列里可以保持的连接数。
如果你有很高的连接率和“连接拒绝”错误的体验,那就需要加大这个值。
查询你的操作系统文档,看看这个参数的最大值。
试图把back_log设置来大于你的操作系统限制是没有用的。
back_log = 50
# 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
不要去监听一个TCP/IP端口。
如果所有的需要连接到mysqld的进程都跑在相同的主机上,这能够增加安全。
所有和mysqld的交互,必须经由unix套接字或者命名管道。
注意:在windows上用这个选项,如果没有可用的命名管道,
(选项enable-named-pipe)将会导致mysqld无效
# 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.
mysql允许的最大并发回话数。他们中的那个有超级权限的用户连接,
即使已经到了连接限制的时候,也可以被保留来允许管理员登录。
max_connections = 100
# 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.
每个主机被允许的最大错误数。如果这个到了这个限制,这个主机连接mysql服务器
将会被阻塞,直到运行了“刷新主机”或者服务器重启。无效的密码或者其他错误在
连接阶段导致这个值的增长。查看“Aborted_connects”状态可以得到变量全局计数器
max_connect_errors = 10
# 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 4096 in the variable "open-files-limit" in
# section [mysqld_safe]
所有进程打开的表的数量。这个值的增长是mysqld要求的文件描述数量的增长。
因此,你必须确保设置打开文件数,即在【myqld_safe】部分的变量
”open-files-limit“至少要允许4096,
table_open_cache = 2048
# 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.
启用外部文件级别锁定。启用文件锁定将对性能产生负面影响,所以你只需要
在同一文件上运行的多个数据库实例的时候用它。(注意一些限制任然适用)
或者如果你用了其他软件依赖在文件级别锁定MyISAM表
#external-locking
# 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
# 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
在事物中二进制日志的SQL查询语句的缓存能够支持的大小。
如果你经常使用大的多实例的查询事物你可以增加这个值来获取更好的性能。
所有来自事物的查询都被缓冲在二进制日志缓存中,并且是当提交的时候立刻
被写在二进制日志中。如果这个事物大于这个值,就使用硬盘的临时文件。
此缓冲区在第一次更新时分配给每个连接。
binlog_cache_size = 1M
# 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
# Size of the buffer used for doing full table scans.
# Allocated per thread, if a full scan is needed.
用于做全表扫描的缓冲区大小。
如果全表扫描需要,为每一个线程分配。
read_buffer_size = 2M
# 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.
排序后,读取排序中的行,通过缓冲区读行避免磁盘寻求。
如果把这个值设的比较大,你可以增加“ORDER BY”的性能。
当需要时为每个线程分配。
read_rnd_buffer_size = 16M
# 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.
排序缓冲用于“ORDER BY and GROUP BY”查询执行排序。
如果排序的数据没有纳入排序缓冲,磁盘的合并排序将会被用来替代,
看这个状态变量:"Sort_merge_passes",当需要时为每个线程分配。
sort_buffer_size = 8M
# 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
这个缓冲是用于连接(无索引的连接)的优化。
在大多数情况下这样的连接不利于性能,但是把这个值设的很大又会减少
性能影响。请看状态变量“Select_full_join”,一个全连接的计数。
当全连接的时候为每个线程分配。
join_buffer_size = 8M
# 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 = 8
# 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]*(2..4) for thread_concurrency
这个允许应用程序,为这个可以在相同时间运行的,想要的线程数,给线程系统一个提示。
这个值仅仅在系统上是有意义的,它提供一个方法叫做thread_concurrency(),(比如工程师)
你可以试试为thread_concurrency设置【cpu数量】*(2..4)
thread_concurrency = 8
# 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.
查询缓存用于缓存查询结果,并且随后返回他们,在没有再一次真实执行相同的查询。
如果你有很多相同的查询并且很少改变表,
有这个缓存查询,使得许多结果有显著的速度提升。
状态变量“Qcache_lowmem_prunes”检查是否这个当前值足够高。
注意:万一你的表经常变,或者如果你的查询每一次都不同,这个查询缓存将会导致降速
而不是性能改进。
query_cache_size = 64M
# 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
# 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 = 4
# 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
# 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.
线程堆栈大小。在连接的时间,这段内存总是被保留的。
mysql自身通常需要不大于64k的内存,当如果你用你自己的堆栈渴望UDF功能,
或者你的系统为了更多的操作需要更多的堆栈,你就可以把这个值设大一点。
thread_stack = 192K
# Set the default transaction isolation level. Levels available are:
# READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
设置默认的事务隔离级别。级别有这些:
不受约束的读, 受约束的读,  可重复的读, 序列化
transaction_isolation = REPEATABLE-READ
# 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
# 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.
启用二进制日志记录。
在复制配置中这是作为master需要的。
如果你需要从最新的备份中及时恢复的能力,那么你需要二进制日志记录
log-bin=mysql-bin
# binary logging format - mixed recommended
二进制日志格式-推荐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.
如果你使用的是被链接的从复制(A-B-C),你需要在B服务器上启用这个选项。
它支持通过从从属线程进入到从属的二进制日志中的日志记录更新
#log_slave_updates
# 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. 
打印警告道错误日志文件中。
如果你对MYSQL有任何问题,你最好启用警告日志,并且检查错误日志可能的解释
#log_warnings
# 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.
慢查询。
慢查询是在log_short_format没启用的情况下,查询那些超过在“long_query_time”中
定义的时间的,或者是没有很好的用索引的。
slow_query_log
# All queries taking more than this amount of time (in seconds) will be
# trated as slow. Do not use "1" 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).
所有查询的时间超过这个时间(以秒为单位)就说明是慢的。这里的值不要用“1”,
因为这会导致甚至快查询有时也被记录到(因为MYSQL 当前记录时间是以秒为精度的)
long_query_time = 2
# ***  Replication related settings 
复制相关的设置
# Unique server identification number between 1 and 2^32-1. This value
# is required for both master and slave hosts. It defaults to 1 if
# "master-host" is not set, but will MySQL will not function as a master
# if it is omitted.
独一无二的服务器识别数字,1~2^32-1。
在master和slave主机都需要这个值。如果没有设置“mater-host”它就是默认为1,
但是如果省略了MySQL将不能作为一个主。
server-id = 1
# Replication Slave (comment out master section to use this)
复制slave(请注释掉主部分来使用这个)
#
# To configure this host as a replication slave, you can choose between
# two methods :
为了配置这个主机为从库,你可以选择这两个方法:
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
1)使用命令:CHANGE MASTER TO(在本手册中完全描述)-语法是:
#
#    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).
这里你需要用引用字符串来代替 <host>, <user>, <password> ,且<port> 是用master
的端口号(默认3306)
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) 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)
#
设置下面的变量。可是,万一你改变方法,就会从第一次开始复制(
甚至不成功,比如你的密码拼写错误,从库就会连接失败)
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
要求独一无二的id在2~2^32-1之间(且与master不同)
如果msater-host设置了,这个值默认是2,
但是如果忽略了就没有salve的功能
#server-id = 2
#
# The replication master for this slave - required
被从库复制的主库 必填
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
用于身份验证的连接到msater的从库的用户名-必填
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
用于身份验证的连接到master的从库的密码
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
master监听的端口
可选的-默认是3306
#master-port = <port>
# 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
使slave 只读。只有用户有超级权限并且复制slave进程能够修改数据。
用这个来确保,在slave上而不是master上,没有应用将会突然修改数据。
#read_only
#*** MyISAM Specific options
MyISAM引擎详细选项
# 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.
索引缓冲区的大小,用于缓存MyISAM表的索引块。
不要设置来大于你可用内存的30%,因为一些内存也被系统用来缓存行。
甚至如果你不用MyISAM引擎表,你也需要设置它为8-64M,因为它也将被用于
内部的临时磁盘表。
key_buffer_size = 32M
# 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 0 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.
MyISAM引擎用特殊的树状缓存来使得批量插入(即:insert...select,
insert ... values(...),(...),..., and load data infile)更快。
这个变量限制了树状缓存每个线程字节的大小。将其设置为0将禁用此优化。
为了最佳性能不要设置它大于“key_buffer_size”。
当检测到批量插入时,将分配此缓冲区。
bulk_insert_buffer_size = 64M
# 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.
 当MySQL需要重建索引,在修补,优化,更改表状态的时候,和重载数据文件到空表一样,
 这个缓冲将会被分配。它为每个进程分配所以设置成大的值小心。
myisam_sort_buffer_size = 128M
# 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).
当重新创建索引(即:在修补,优化,更改表状态的时候)的时候,
MySQL被允许的最大临时文件大小。
如果“file-size”大于这值,索引将会通过键缓存创建(这样比较慢)
myisam_max_sort_file_size = 10G
# 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则可以用不止一个进程并行排序来修补他们。
如果你有多CPU何足够的内存,这很好理解。
myisam_repair_threads = 1
# Automatically check and repair not properly closed MyISAM tables.
自动检查和修复不适当关闭MyISAM表
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.
如果你的MySQL服务支持InnoDB但是你又不想用它,就可以用这个选项。
这可以节省内存和磁盘空间并且加快速度
#skip-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使用存储元数据信息的额外内存池。
如果InnoDB需要更多的内存,OS将会分配给它。因为在大多最近的操作系统中这个足够快,
你一般不需要改变这值。SHOW INNODB STATUS可以展示目前的用量。
innodb_additional_mem_pool_size = 16M
# 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 80% 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 2-3.5G of user level memory per process, so do not
# set it too high.
InnoDB,不像MyISAM,它用缓冲池来缓存索引和行数据。
你把这值设的越大,就更少的用到磁盘I/O访问数据表。
在专用数据库服务器上,你可以设置这个参数为机器物理内存的80%。不要再设大了,
因为物理内存的竞争将会导致操作系统分页。
innodb_buffer_pool_size = 2G
# 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以表空间的形式在一个或多个数据文件中存储数据。
如果您的数据有一个单一的逻辑驱动器,一个单一的自扩充文件将会足够好。
在其他情况下,一个设备一个文件常常是一个好的选择。
你可以配置InnoDB来使用磁盘分区-可以参照手册获取更多的信息
innodb_data_file_path = ibdata1:10M:autoextend
# 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表空间文件储存在其他地址。默认在MYSQL的数据目录
#innodb_data_home_dir = <directory>
# Number of IO threads to use for async IO operations. This value is
# hardcoded to 8 on Unix, but on Windows disk I/O may benefit from a
# larger number.
异步操作的IO线程数。在Unix系统这个值写死为8的,但是windows系统这
个数比较大一点的话磁盘I/O性能会比较好。
innodb_write_io_threads = 8
innodb_read_io_threads = 8
# If you run into InnoDB tablespace corruption, setting this to a nonzero
# value will likely help you to dump your tables. Start from value 1 and
# increase it until you're able to dump the table successfully.
如果您遇到InnoDB表空间损坏,设置这个值为非0的将会帮你清理表。
值从1开始增长到直到你可以成功的清理表。
#innodb_force_recovery=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内核允许的线程数。其最优值高度依赖应用程序,硬件和操作系统
。调度程序属性。太大的值会导致线程超负荷。
innodb_thread_concurrency = 16
# 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.
如果设为1,每次ACID提交的时候,InnoDB将会同步刷新事物日志到硬盘。
如果你想妥协这安全,你就跑少一些事物,你可以设这个值为0或者2来缩小磁盘
I/O写日志。
值为0表示日志仅仅是写到日志文件,并且日志文件大约每秒刷新一次磁盘。
值为2表示每次提交都会把日志写到日志文件,并且日志文件大约每秒刷新一次磁盘。
innodb_flush_log_at_trx_commit = 1
# 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关闭。这将禁止InnoDB完全清除并在关机时插入缓冲区合并。
它将花费更多的关闭时间,但是InnoDB将必须在下次开始的时候做这个事情。
#innodb_fast_shutdown
# 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用于缓冲日志数据的大小。
一旦它满了,InnoDB将会把它刷新到磁盘。以为它是一秒刷新一次,
所以不要把它设置的很大(即便是在长事物中)
innodb_log_buffer_size = 8M
# Size of each log file in a log group. You should set the combined size
# of log files to about 25%-100% 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.
日志组中每个日志文件的大小。你可以设置合并的日志文件大小为你的缓冲池大小的
25%-100%,以避免无用的在日志文件重写的时候的缓冲池刷新活动。
但是,注意,一个大的日志文件将会增加恢复程序需要的时间。
innodb_log_file_size = 256M
# Total number of files in the log group. A value of 2-3 is usually good
# enough.
日志组里面的文件总数。2-3就足够了。
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日志文件的位置。默认是mysql数据目录。
你可以指定一个专门的硬盘或者RAID1卷来提高性能
#innodb_log_group_home_dir
# 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缓冲池中脏页面允许的最大百分比。如果它满了,InnoDB将会把它冲洗出来
而根本不是把它清理干净。
这是一个软限制,不是一定要保留的。
innodb_max_dirty_pages_pct = 90
# 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刷新日志的方法。表空间常常用的是双写刷新逻辑。
默认是“fdatasync”,其他选项是“O_DSYNC”。
#innodb_flush_method=O_DSYNC
# 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事物在回滚之前可以等待的多长时间。InnoDB在他自己的锁表中自动检测事物死锁,
并且回滚这个事物。在相同的事物中,如果你用命令:LOCK TABLES,
或者其他transaction-safe储存引擎,而不是InnoDB,那么就会发生InnoDB不能通知的死锁。
因此这个超时就会对解决这个处境很有用。
innodb_lock_wait_timeout = 120
[mysqldump]
# Do not buffer the whole result set in memory before writing it to
# file. Required for dumping very large tables
在写到文件以前,不缓冲整个结果集的内存。对于大表示必须的
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Only allow UPDATEs and DELETEs that use keys.
#safe-updates
[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[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 = 8192

时间: 2024-08-27 19:27:18

mysql配置文件-my-innodb-heavy-4G.cnf中文注释的相关文章

ehcache.xml 配置文件备忘录(不建议出现中文注释,此处备忘)

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../config/ehcache.xsd" updateCheck="false"> <diskStore path="java.io.tmpdir"/> <!-- Mandatory Default Cach

centos7下查看mysql配置文件适用顺序

mysql --help|grep 'my.cnf' [[email protected] ~]# mysql --help|grep 'my.cnf' order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf mysql默认会搜寻my.cnf的目录,顺序排前的优先. 阿里云服务器mysql配置文件生效位置 /etc/my.cnf 参考 https://blog.csdn.net/q

mysql代码里面有中文注释导致语法错误

一个简单的创建表的代码 DROP database IF exists reg_login; CREATE database reg_login; use reg_login --用户表 create table user_table( user_id int(11) auto_increment, user_name varchar(50) not null, user_pass varchar(50) not null, email varchar(100), primary key(use

Springboot2-application.properties文件中文注释都是unicode编码

问题描述: 用 intellij 打开springboot的配置文件application.properties经常会出现中文注释编程unicode编码的情况: 问题解决: 1.打开 File-->Settings...-->Editor-->File Encodings 2.选中application.properties文件进行如图配置 原文地址:https://www.cnblogs.com/happyflyingpig/p/12122155.html

MySQL 配置文件my.cnf

转载: MySQL配置文件my.cnf 详解: #BEGIN CONFIG INFO#DESCR: 4GB RAM, 只使用InnoDB, ACID, 少量的连接, 队列负载大#TYPE: SYSTEM#END CONFIG INFO ## 此mysql配置文件例子针对4G内存. # 主要使用INNODB#处理复杂队列并且连接数量较少的mysql服务器## 将此文件复制到/etc/my.cnf 作为全局设置,# mysql-data-dir/my.cnf 作为服务器指定设置# (@[email 

MySQL配置文件my.cnf设置

转自 http://www.blogjava.net/baoyaer/articles/209466.html 设置建议: 对于单台运行的WEB服务器,建议加上: skip-locking skip-name-resolve skip-networking 在PHP链接数据库时使用"LOCALHOST".这样MySQL 客户端库将覆盖之并尝试连接到本地套接字.( 我们可以从PHP.INI中 代码: ; Default socket name for local MySQL connec

Mysql配置文件my.cnf配置及配置参数详解

Mysql配置文件my.cnf 安装了mysql没有my.cnf文件的情况 1.可以把mysql的示例配置文件,如my-medium.cnf拷贝到/etc/my.cnf,再去修改/etc/my.cnf的配置/usr/share/doc/MySQL-server-5.5.38/my-medium.cnf(Example MySQL config file for medium systems with little memory (32M - 64M) ) 可以通过命令:find / -name 

Linux中MySQL配置文件my.cnf参数优化

MySQL参数优化这东西不好好研究还是比较难懂的,其实不光是MySQL,大部分程序的参数优化,是很复杂的.MySQL的参数优化也不例外,对于不同的需求,还有硬件的配置,优化不可能又最优选择,只能慢慢的进行优化,需要不断的调试,才能达到不同环境的最优选择. 首先介绍一下MySQL配置文件中不同模块 [client] MySQL客户端应用模块,只有MySQL附带的客户端应用程序保证可以读取此模块下的内容. [mysqld] MySQL服务端应用模块 [client] port = 3306 sock

mysql配置文件my.cnf整理

随时修改: 1 [mysqld] 2 #basedir= 3 datadir=/var/lib/mysql 4 #mysql.default_port=3306 5 #mysql.default_socket=/tmp/mysql.sock 6 socket=/var/lib/mysql/mysql.sock 7 #socket=/tmp/mysql.sock 8 user=mysql 9 # Disabling symbolic-links is recommended to prevent