一个生产可用的mysql参数文件my.cnf

Posted ChavinKing

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了一个生产可用的mysql参数文件my.cnf相关的知识,希望对你有一定的参考价值。

[client]
default-character-set=utf8
port = 3306
[mysqld]
server_id = 062401
basedir = /opt/mysql-5.6.24
datadir = /opt/mysql-5.6.24/data
tmpdir = /tmp
socket = /tmp/mysql.sock
port = 3306
binlog_format = mixed
log-bin = mysql-bin
relay-log = mysql-relay-bin
log-slave-updates = 1
skip_slave_start = 1
skip-name-resolve = 1
max_allowed_packet = 16M
read_only = 0
default_storage_engine = InnoDB
character_set_server = utf8
skip-external-locking = 1
innodb_strict_mode = 1
innodb_buffer_pool_size = 256M      #mysql数据库服务器,该值可设为物理内存的50%-80%之间
innodb_stats_on_metadata = 0
innodb_file_format = Barracuda
innodb_flush_method = O_DIRECT
innodb_log_files_in_group = 2
innodb_log_file_size = 16M
innodb_log_buffer_size = 8M
innodb_file_per_table = 1
innodb_max_dirty_pages_pct = 60
innodb_io_capacity = 200
innodb_flush_log_at_trx_commit=1

key_buffer_size = 8M
tmp_table_size = 8M
max_heap_table_size = 8M
table_open_cache = 1024
query_cache_type = 0
query_cache_size = 0
max_connections = 1000
thread_cache_size = 1024
open_files_limit = 65535

log_error = /opt/mysql-5.6.24/data/mysql.log
slow_query_log = 1
slow_query_log_file = /opt/mysql-5.6.24/data/mysql-slow.log

plugin-load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"

replicate-ignore-table = mysql.ibbackup_binlog_marker
slave-skip-errors = ddl_exist_errors
sync_binlog = 1
max_binlog_size = 16M
relay-log-info-repository = TABLE
relay_log_recovery = 1
master_info_repository = TABLE

gtid-mode = ON
enforce-gtid-consistency = 1

lower_case_table_names=1
log-bin-trust-function-creators

以上是关于一个生产可用的mysql参数文件my.cnf的主要内容,如果未能解决你的问题,请参考以下文章

Linux中MySQL配置文件my.cnf参数说明

MySQL5.7: my.cnf参数速查小册子

MySQL参数学习

参数文件位置

Ubuntu 下面 MySQL 的参数文件 my.cnf 浅析

my.cnf 配置文件参数解释