Mysql My.ini 詳細說明

CLIENT SECTION 
客戶端章節:
 
[client] 
port=3306            端口號=3306 

[mysql] 
default-character-set=latin1    默認字符編碼=latin1 

SERVER SECTION 
服務端章節
 
[mysqld] 

# The TCP/IP Port the MySQL Server will listen on 
TCP/IP Port 監聽mysql的端口號    
port=3306 


#Path to installation directory. All paths are usually resolved relative to this.  
安裝目錄路徑 。全部的路徑都是做爲這個路徑的相對路徑。  
basedir="E:/programfile/MySql5.1/" 

#Path to the database root 
數據庫數據的根路徑  
datadir="C:/ProgramData/MySQL/MySQL Server 5.1/Data/" 

# The default character set that will be used when a new schema or table is 
# created and no character set is defined 
默認的字符集編碼做用於當一個新的schema 或者表被建立的時候沒有指定字符集。  
default-character-set=latin1 

# The default storage engine that will be used when create new tables when 
默認的存儲引擎做用於當建立新表的時候  
default-storage-engine=INNODB 

# Set the SQL mode to strict 
設置嚴格的SQL模型  

sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" 


# 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 

# 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. 
查詢緩存用於在緩存中SELECT結果,返回不是實際查詢數據庫的結果。 
從緩存中查詢的結果會顯著的提高查詢速度,若是你有不少相同的查詢和不多改變表結構。 
查看「Qcache_lowmem_prunes」狀態變量來檢查當前值對於你的負載是否足夠高。 
NOTE:若是你的表結構常常改變或者,你每次查詢都不相同,那麼使用查詢緩存結果可能不是一個性能改進。
 
query_cache_size=15M 

# 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] 
全部的線程打開表的數量。  
table_cache=256 

# 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=18M 


# 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=8 

#*** MyISAM Specific options 
MYISAM 特殊配置項
 

# 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臨時文件容許使用重建索引(在修復,修改表結構,導入數據文件時)的最大大小。 
若是文件大小會比這個大,該指數將被建立經過鍵緩存(很慢)
 
myisam_max_sort_file_size=100G 

# If the temporary file used for fast index creation would be bigger 
# than using the key cache by the amount specified here, then prefer the 
# key cache method.  This is mainly used to force long character keys in 
# large tables to use the slower key cache method to create the index. 
若是臨時文件用於快速建立索引將比使用鍵緩存更大,那麼鍵緩存的方法是很好的。這主要用於在比較大型的表使用緩慢的基礎上,使用長字符串建立索引。  
myisam_sort_buffer_size=35M 

# 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%,由於一些內存還須要由OS緩存行,即便您沒有使用MyISAM表,您仍然應該將其設置爲8 - 64 m,由於它也會用於內部臨時磁盤表  
key_buffer_size=8M 

# Size of the buffer used for doing full table scans of MyISAM tables. 
# Allocated per thread, if a full scan is needed. 
MyISAM表用來作全表掃描的緩衝區大小 
若是須要一個完整的掃描,就分配給每個線程
 
read_buffer_size=64K 
read_rnd_buffer_size=256K 

# This buffer is allocated when MySQL needs to rebuild the index in 
# REPAIR, OPTIMZE, 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在須要修理,OPTIMZE,修改表結構語句以及導入加載數據 
到一個空表時重建索引。它是分配給每一個線程,因此在大型設置中要當心使用。
 
sort_buffer_size=256K 


#*** INNODB Specific options *** 
INNODB特殊項
 
INNODB保存數據目錄 
innodb_data_home_dir="E:/MySQL Datafiles/" 

# 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 

# 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爲此它會分配它的操做系統內存。由於在大多數操做系統中,這已是足夠快的了,因此一般不須要修改這個值。SHOW INNODB STATUS會顯示當前的使用量  
innodb_additional_mem_pool_size=2M 

# 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,InnoDB會在每一個提交磁盤沖洗事務日誌,這提供了完整的ACID的行爲. 
若是你想安全,而且正在執行一些小操做,你能夠設置爲0或者2在減小磁盤I / O日誌。
 
#innodb_flush_log_at_trx_commit=1 

# 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=1M 

# 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%的機器的物理內存大小。不用把它設置的太大,不過,由於在操做系統中競爭的物理內存可能致使內存不夠分。注意,32位系統上的你可能被限制在2 - 3.5g的用戶級內存,因此不要設置的過高。  
innodb_buffer_pool_size=83M 

# 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=17M 

# 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=8 
相關文章
相關標籤/搜索