MySQL my.cnf 配置文件注釋


以下是my.cnf配置文件參數解釋

[client]

port                     = 3309
socket                   = /home/longxibendi/mysql/tmp/mysql.sock


[mysqld]


!include /home/longxibendi/mysql/etc/mysqld.cnf      #包含的配置文件 ,把用戶名,密碼文件單獨存放


port                     = 3309
socket                   = /home/longxibendi/mysql/tmp/mysql.sock
pid-file                 = /longxibendi/mysql/mysql/var/mysql.pid
basedir                  = /home/mysql/mysql/
datadir                  = /longxibendi/mysql/mysql/var/


# tmp dir settings
tmpdir                   = /home/longxibendi/mysql/tmp/
slave-load-tmpdir        = /home/longxibendi/mysql/tmp/ 
#當slave 執行  load data infile  時用



language                 = /home/longxibendi/mysql/share/mysql/english/
character-sets-dir       = /home/longxibendi/mysql/share/mysql/charsets/


# skip options 
skip-name-resolve           #grant 時,必須使用ip不能使用主機名
skip-symbolic-links         #不能使用連接文件
skip-external-locking       #不使用系統鎖定,要使用myisamchk,必須關閉服務器
skip-slave-start            #啟動mysql,不啟動復制


#sysdate-is-now


# res settings
back_log                 = 50   #接受隊列,對於沒建立tcp連接的請求隊列放入緩存中,隊列大小為back_log,受限制與OS參數
max_connections          = 1000                 #最大並發連接數 ,增大該值需要相應增加允許打開的文件描述符數
max_connect_errors       = 10000                #如果某個用戶發起的連接error超過該數值,則該用戶的下次連接將被阻塞,直到管理員執行flush hosts ; 命令;防止黑客
#open_files_limit         = 10240


connect-timeout          = 10                   #連接超時之前的最大秒數,在Linux平台上,該超時也用作等待服務器首次回應的時間
wait-timeout             = 28800 #等待關閉連接的時間
interactive-timeout      = 28800 #關閉連接之前,允許interactive_timeout(取代了wait_timeout)秒的不活動時間。客戶端的會話wait_timeout變量被設為會話interactive_timeout變量的值。


slave-net-timeout        = 600 #從服務器也能夠處理網絡連接中斷。但是,只有從服務器超過slave_net_timeout秒沒有從主服務器收到數據才通知網絡中斷
net_read_timeout         = 30 #從服務器讀取信息的超時
net_write_timeout        = 60 #從服務器寫入信息的超時
net_retry_count          = 10 #如果某個通信端口的讀操作中斷了,在放棄前重試多次
net_buffer_length        = 16384 #包消息緩沖區初始化為net_buffer_length字節,但需要時可以增長到max_allowed_packet字節
max_allowed_packet       = 64M #



table_cache              = 512 #所有線程打開的表的數目。增大該值可以增加mysqld需要的文件描述符的數量
thread_stack             = 192K #每個線程的堆棧大小
thread_cache_size        = 20 #線程緩存
thread_concurrency       = 8 #同時運行的線程的數據 此處最好為CPU個數兩倍。本機配置為CPU的個數


# qcache settings
query_cache_size         = 256M #查詢緩存大小
query_cache_limit        = 2M #不緩存查詢大於該值的結果
query_cache_min_res_unit = 2K #查詢緩存分配的最小塊大小


# default settings
# time zone
default-time-zone        = system #服務器時區
character-set-server     = utf8 #server級別字符集
default-storage-engine   = InnoDB #默認存儲


# tmp & heap 
tmp_table_size           = 512M #臨時表大小,如果超過該值,則結果放到磁盤中
max_heap_table_size      = 512M #該變量設置MEMORY (HEAP)表可以增長到的最大空間大小


log-bin                  = mysql-bin #這些路徑相對於datadir
log-bin-index            = mysql-bin.index
relay-log                = relay-log
relay_log_index          = relay-log.index


# warning & error log
log-warnings             = 1
log-error                = /home/mysql/mysql/log/mysql.err


log_output               = FILE #參數log_output指定了慢查詢輸出的格式,默認為FILE,你可以將它設為TABLE,然后就可以查詢mysql架構下的slow_log表了


# slow query log
slow_query_log           = 1
long-query-time          = 1 #慢查詢時間  超過1秒則為慢查詢
slow_query_log_file      = /home/mysql/mysql/log/slow.log
#log-queries-not-using-indexes
#log-slow-slave-statements


general_log              = 1
general_log_file         = /home/mysql/mysql/log/mysql.log
max_binlog_size          = 1G
max_relay_log_size       = 1G


# if use auto-ex, set to 0
relay-log-purge          = 1 #當不用中繼日志時,刪除他們。這個操作有SQL線程完成


# max binlog keeps days
expire_logs_days         = 30 #超過30天的binlog刪除


binlog_cache_size        = 1M #session級別


# replication
replicate-wild-ignore-table     = mysql.% #復制時忽略數據庫及表
replicate-wild-ignore-table     = test.% #復制時忽略數據庫及表
# slave_skip_errors=all


key_buffer_size                 = 256M #myisam索引buffer,只有key沒有data
sort_buffer_size                = 2M #排序buffer大小;線程級別
read_buffer_size                = 2M #以全表掃描(Sequential Scan)方式掃描數據的buffer大小 ;線程級別
join_buffer_size                = 8M # join buffer 大小;線程級別
read_rnd_buffer_size            = 8M #MyISAM以索引掃描(Random Scan)方式掃描數據的buffer大小 ;線程級別
bulk_insert_buffer_size         = 64M #MyISAM 用在塊插入優化中的樹緩沖區的大小。注釋:這是一個per thread的限制
myisam_sort_buffer_size         = 64M #MyISAM 設置恢復表之時使用的緩沖區的尺寸,當在REPAIR TABLE或用CREATE INDEX創建索引或ALTER TABLE過程中排序 MyISAM索引分配的緩沖區
myisam_max_sort_file_size       = 10G #MyISAM 如果臨時文件會變得超過索引,不要使用快速排序索引方法來創建一個索引。注釋:這個參數以字節的形式給出.重建MyISAM索引(在REPAIR TABLE、ALTER TABLE或LOAD DATA INFILE過程中)時,允許MySQL使用的臨時文件的最大空間大小。如果文件的大小超過該值,則使用鍵值緩存創建索引,要慢得多。該值的單位為字節
myisam_repair_threads           = 1 #如果該值大於1,在Repair by sorting過程中並行創建MyISAM表索引(每個索引在自己的線程內)
myisam_recover                = 64K#允許的GROUP_CONCAT()函數結果的最大長度


transaction_isolation           = REPEATABLE-READ


innodb_file_per_table


#innodb_status_file              = 1
#innodb_open_files              = 2048
innodb_additional_mem_pool_size = 100M #幀緩存的控制對象需要從此處申請緩存,所以該值與innodb_buffer_pool對應
innodb_buffer_pool_size         = 2G #包括數據頁、索引頁、插入緩存、鎖信息、自適應哈希所以、數據字典信息
innodb_data_home_dir            = /longxibendi/mysql/mysql/var/
#innodb_data_file_path           = ibdata1:1G:autoextend
innodb_data_file_path           = ibdata1:500M;ibdata2:2210M:autoextend   #表空間
innodb_file_io_threads          = 4     #io線程數
innodb_thread_concurrency       = 16 #InnoDB試着在InnoDB內保持操作系統線程的數量少於或等於這個參數給出的限制
innodb_flush_log_at_trx_commit  = 1 #每次commit 日志緩存中的數據刷到磁盤中


innodb_log_buffer_size          = 8M #事物日志緩存
innodb_log_file_size            = 500M #事物日志大小
#innodb_log_file_size            =100M
innodb_log_files_in_group       = 2 #兩組事物日志
innodb_log_group_home_dir       = /longxibendi/mysql/mysql/var/#日志組


innodb_max_dirty_pages_pct      = 90            #innodb主線程刷新緩存池中的數據,使臟數據比例小於90%
innodb_lock_wait_timeout        = 50 #InnoDB事務在被回滾之前可以等待一個鎖定的超時秒數。InnoDB在它自己的 鎖定表中自動檢測事務死鎖並且回滾事務。InnoDB用LOCK TABLES語句注意到鎖定設置。默認值是50秒
#innodb_flush_method            = O_DSYNC


[mysqldump]
quick
max_allowed_packet              = 64M


[mysql]
disable-auto-rehash #允許通過TAB鍵提示
default-character-set           = utf8
connect-timeout                 = 3

原文鏈接:http://blog.csdn.net/longxibendi/article/details/6704969


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM