mysql的配置文件my.cnf参考参数

[mysqld]

#

# Remove leading # and set to the amount of RAM for the most important data

# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.

# innodb_buffer_pool_size = 128M

#

# Remove leading # to turn on a very important data integrity option: logging

# changes to the binary log between backups.

# log_bin

#

# Remove leading # to set options mainly useful for reporting servers.

# The server defaults are faster for transactions and fast SELECTs.

# Adjust sizes as needed, experiment to find the optimal values.

# join_buffer_size = 128M

# sort_buffer_size = 2M

# read_rnd_buffer_size = 2M

datadir=/disk/mysql

socket=/var/lib/mysql/mysql.sock

lower_case_table_names=1

expire_logs_days=7

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0


#log-error=/var/log/mysql/mysqld.log

log-error=/disk/destroyer/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid


# 设置相关的字符串编码

collation-server = utf8_unicode_ci

max_allowed_packet=500M

# 解决errno: 24 - Too many open files报错

open_files_limit = 65535

server-id=1

log-bin=cloud-mysql-bin

binlog_cache_size=1M

relay_log=cloud-mysql-relay-bin

log_slave_updates=1

auto_increment_increment=2

auto_increment_offset=1

init-connect='SET NAMES utf8'

character-set-server = utf8

sync_binlog = 1

binlog_checksum = none

binlog_format = mixed

slave-skip-errors = all

binlog-ignore-db = mysql,information_schema

sql_mode=""

wait_timeout=600
max_connections = 2000
slow_query_log = 1
slow_query_log_file = /disk/destroyer/log/mysql-slow.log
long_query_time = 1
log_output = TABLE,FILE
# log-queries-not-using-indexes
thread_stack=512k
# 根据IOPS能力设置
innodb_io_capacity=400
innodb_io_capacity_max=800
# 设置避免连坐机制
innodb_flush_neighbors=0
# 原本要设置为所有物理内存的75%,考虑到原来配置”抖“的频次不高,设置为未使用内存的50%,避免产生浪费
innodb_buffer_pool_size=5368709120

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