MySQL5.6数据库优化my.cnf配置

07/20 系统架构 阅读 327 views 次 人气 0
摘要:

MySQL5.6数据库优化my.cnf配置。

系统环境:

4核    8G    CentOS7.0    MySQL5.6


配置内容:

[client]
port=3306
socket=/var/lib/mysql/mysql.sock
default-character-set=utf8


[mysqld]
bind-address=0.0.0.0
port=3306
socket=/var/lib/mysql/mysql.sock

datadir=/var/lib/mysql
character-set-server=utf8
 

##############################################################################
#innodb
default_storage_engine=InnoDB
user=mysql
innodb_buffer_pool_size=6G
innodb_log_file_size=4G
innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=2
innodb_file_per_table=1
innodb_file_io_threads=4
innodb_flush_method=O_DIRECT
innodb_io_capacity=2000
innodb_io_capacity_max=6000
innodb_lru_scan_depth=2000
innodb_thread_concurrency = 0
innodb_additional_mem_pool_size=16M
innodb_autoinc_lock_mode = 2
##############################################################################
# Binary log/replication
#log-bin
sync_binlog=1
sync_relay_log=1
relay-log-info-repository=TABLE
master-info-repository=TABLE
expire_logs_days=7
binlog_format=ROW
transaction-isolation=READ-COMMITTED
##############################################################################
#cache
tmp_table_size=512M
character-set-server=utf8
collation-server=utf8_general_ci
skip-external-locking
back_log=1024
key_buffer_size=1024M
thread_stack=256k
read_buffer_size=8M
thread_cache_size=64
query_cache_size=128M
max_heap_table_size=256M
query_cache_type=1
binlog_cache_size = 2M
table_open_cache=128
thread_cache=1024
thread_concurrency=8
wait_timeout=30
join_buffer_size = 1024M
sort_buffer_size = 8M
read_rnd_buffer_size = 8M
##############################################################################
#connect
max-connect-errors=100000
max-connections=1000
##############################################################################
explicit_defaults_for_timestamp=true
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
##############################################################################


[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid


评论

该文章不支持评论!

分享到: