[client]
#user=admin
#password=123
[mysqld]
########basic settings########
server-id = 1
port = 3306
user = mysql #服务默认用户名
#bind_address = 0.0.0.0
#autocommit = 0 #5.6安装时需要注释掉
character_set_server=utf8mb4
skip_name_resolve = 1
max_connections = 800
max_connect_errors = 1000
datadir = /data/mysql_data #数据保存路径
transaction_isolation = READ-COMMITTED #事务隔离级别
explicit_defaults_for_timestamp = 1
join_buffer_size = 134217728 #join查询时的内存,线程级参数
tmp_table_size = 67108864
tmpdir = /tmp
max_allowed_packet = 16777216 #单条插入最大限制
sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"
interactive_timeout = 1800
wait_timeout = 1800
read_buffer_size = 16777216
read_rnd_buffer_size = 33554432
sort_buffer_size = 33554432
########log settings########
log_error = error.log #错误日志文件名
slow_query_log = 1 #是否开启慢查询日志
slow_query_log_file = slow.log #慢查询日志文件名
log_queries_not_using_indexes = 1 #将没有使用索引的SQL语句记录到慢查询
log_slow_admin_statements = 1 #记录管理操作,如ALTER/ANALYZE TABLE
log_slow_slave_statements = 1 #在从服务器上开启慢查询日志
log_throttle_queries_not_using_indexes = 10 #限制每分钟没有使用索引SQL语句的次数
expire_logs_days = 90 #binlog保存天数
long_query_time = 2 #指定慢查询阈值
min_examined_row_limit = 100 #扫描记录少于该阈值的SQL不记录到慢查询日志
max_binlog_size = 2048M #binlog日志单文件最大容量
########replication settings########
master_info_repository = TABLE
relay_log_info_repository = TABLE
log_bin = bin.log
sync_binlog = 1
gtid_mode = on
enforce_gtid_consistency = 1
log_slave_updates
binlog_format = row #binlog日志级别,在事务隔离级别为RC的时候,此值一定要设为row
relay_log = relay.log
relay_log_recovery = 1
binlog_gtid_simple_recovery = 1
slave_skip_errors = ddl_exist_errors
########innodb settings########
innodb_page_size = 8192 #设置每个页的大小是多少(mysql中页相当于Oracle块的概念)
innodb_buffer_pool_size = 6G #设置缓冲池大小,尽可能的大
innodb_buffer_pool_instances = 8 #缓冲池个数;最好配置成cpu的数量
innodb_buffer_pool_load_at_startup = 1 #mysql启动时自动加载备份的缓冲池文件(根据 id和page unmber读一遍数据)
innodb_buffer_pool_dump_at_shutdown = 1 #mysql正常关闭时将缓冲池内数据备份到ib_buffer_pool文件中
innodb_lru_scan_depth = 500 #脏页刷新能力除以缓冲池数量
innodb_lock_wait_timeout = 5 #事务锁超时时间
innodb_io_capacity = 4000 #一次刷新最多脏页的数量是多少,设置成固态硬盘的写iops值
innodb_io_capacity_max = 8000
innodb_flush_method = O_DIRECT #把文件直接写入磁盘(开启裸设备),fdatasync(默认),O_DSYNC,O_DIRECT
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda
#innodb_log_group_home_dir = /redolog/ #redo日志位置,默认在data下
#innodb_undo_directory = /undolog/ #undo日志位置,默认在data下
innodb_undo_logs = 128 #有多少undo日志段,一个日志段长度为1024
innodb_undo_tablespaces = 3 #创建3个undo表空间文件
innodb_flush_neighbors = 0 #刷脏页刷整个区的脏页
innodb_log_file_size = 4G #重做日志大小(要设的足够的大)推荐设置8G
innodb_log_buffer_size = 16777216
innodb_purge_threads = 4 #设置purge线程数,线程调大,删除数据回收的更快
innodb_large_prefix = 1
innodb_thread_concurrency = 64
innodb_print_all_deadlocks = 1
innodb_strict_mode = 1
innodb_sort_buffer_size = 67108864
####优化####
innodb_adaptive_hash_index = OFF
innodb_flush_neighbors = 0
########semi sync replication settings########
plugin_dir=/usr/local/mysql5.6/lib/plugin
plugin_load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"
loose_rpl_semi_sync_master_enabled = 1
loose_rpl_semi_sync_slave_enabled = 1
loose_rpl_semi_sync_master_timeout = 5000
[mysqld-5.7]
innodb_buffer_pool_dump_pct = 40 #缓冲池导出只导出前百分之40
innodb_page_cleaners = 4
innodb_undo_log_truncate = 1
innodb_max_undo_log_size = 2G
innodb_purge_rseg_truncate_frequency = 128
binlog_gtid_simple_recovery=1
log_timestamps=system
transaction_write_set_extraction=MURMUR32
show_compatibility_56=on
#slave-parallel-type=LOGICAL_CLOCK #开启从机并行复制
#slave-parallel-workers=32 #三十二个线程做并行复制
#auto_increment_increment = 1 #自增长字段的步长,增长量
#auto_increment_offset = 1 #自增长字段的起始值
#relay_log_puge = 0 #删除中继日志。0为不删除
mysql配置文件
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...