mysql的配置
mysql的运营配置:连接字符串、连接数、连接时间、处理线程数最大值、处理线程数最小值、主从配置、日志、innodb的buffer_cache、内存中的临时表大小等信息。
[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