mysql的配置

mysql的配置

        mysql的運營配置:鏈接字符串、鏈接數、鏈接時間、處理線程數最大值、處理線程數最小值、主從配置、日誌innodb的buffer_cache、內存中的臨時表大小等信息。java

[client]
port = 3306

[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data

#配置此項能夠追蹤sql執行記錄
log=/usr/local/mysql/log/mysql-sql.log

##如下爲開啓主從的必要配置
server-id = 1
log_bin = /usr/local/mysql/data/log/mysql-bin.log #日誌名字
binlog-do-db=db_nameA #指定對db_nameA記錄二進制日誌  
binlog-ignore-db=db_namB #指定不對db_namB記錄二進制日誌
expire_logs_days = 30     #存活30天
character-set-server = utf8 #服務器的字符集
default-storage-engine = InnoDB #默認啓動InnoDB服務器

#connection(鏈接)
max_connections = 1024
max_connect_errors = 1024

# Try number of CPU's*2 for thread_concurrency(線程:CPU個數的2倍)
thread_concurrency = 8    #保留線程
thread_cache_size = 256    #線程池

#*network
skip-name-resolve
max_allowed_packet = 1M

#buffer(表緩存、join查詢緩存)
table_open_cache = 4096
sort_buffer_size = 256K
join_buffer_size = 256K

#query cache(查詢緩存)
query_cache_limit = 4M
query_cache_size = 4M
query_cache_type = 1

#temptable(內存中的臨時表)
tmp_table_size = 64M
max_heap_table_size = 64M

#Innodb(主要)

innodb_buffer_pool_size = 5G

innodb_log_file_size = 256M
innodb_log_files_in_group = 2
innodb_status_file = 1

innodb_additional_mem_pool_size = 32M
innodb_data_file_path = ibdata1:1G:autoextend
innodb_file_per_table = 1

innodb_additional_mem_pool_size = 32M
innodb_buffer_pool_size = 5G
innodb_data_file_path = ibdata1:1G:autoextend
innodb_file_per_table = 1

innodb_force_recovery = 0
#innodb_table_locks
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_force_recovery = 0

#innodb_table_locks
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2

#slow log
slow_query_log=1
long_query_time=1
slow_query_log_file=/var/lib/mysql/log/slow.log

[mysqld_safe]
#error log
log-error = /usr/local/mysql/log/mysqld.log
open-files-limit = 40960 #(文件描述符)

[mysqldump]
max_allowed_packet = 48M
相關文章
相關標籤/搜索