mysql數據庫參數解析

My.cnf

[client]  

port = 3309

socket = /home/mysql/mysql/tmp/mysql.sock  

[mysqld]  

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

port = 3309

socket = /home/mysql/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/mysql/mysql/tmp/  

slave-load-tmpdir = /home/mysql/mysql/tmp/  

#當slave 執行 load data infile 時用  

#language = /home/mysql/mysql/share/mysql/english/  

character-sets-dir = /home/mysql/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  

relayrelay-log = relay-log  

relayrelay_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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章