[client]
# CLIENT #
port = 3306
socket=/var/lib/mysql/mysql.sock #socket文件路径,需要根据实际情况修改
default-character-set = utf8
[mysqld]
# GENERAL #
basedir = /usr #软件存放路径,需要根据实际情况修改
datadir=/mysql/3306/data #data存放路径,需要根据实际情况修改
socket = /var/lib/mysql/mysql.sock #socket文件路径,需要根据实际情况修改
pid-file = /var/run/mysqld/mysqld.pid #pidfile文件路径,需要根据实际情况修改
server-id = 1 #需要根据实际情况修改
sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"
user = mysql
default_storage_engine = InnoDB
character-set-server = utf8
skip-external-locking
skip-host-cache
skip-name-resolve
autocommit = on
max_allowed_packet = 16M
max_connections = 1000
max_user_connections = 1000
max_connect_errors = 1000000
wait_timeout = 1800
transaction_isolation = READ-COMMITTED
explicit_defaults_for_timestamp = 1
query-cache-type = 0
query-cache-size = 0
thread-cache-size = 50
open-files-limit = 65535
tmpdir = /mysql/3306/tmp #tmp文件存放路径,需要根据实际情况修改
slave_load_tmpdir = /mysql/3306/tmp #tmp文件存放路径,需要根据实际情况修改
# session memory settings #
tmp-table-size = 32M
max-heap-table-size = 32M
read_buffer_size = 16M
read_rnd_buffer_size = 32M
sort_buffer_size = 32M
join_buffer_size = 64M
key-buffer-size = 64M
# table cache performance settings #
table_open_cache = 4096
table_definition_cache = 4096
table_open_cache_instances = 64 #最大64
# INNODB #
innodb_open_files=2048
innodb_buffer_pool_size = RAM*60% #innodb缓冲池大小,需要根据实际情况修改,建议为RAM的60%-70%
innodb_sort_buffer_size = 64M
innodb_buffer_pool_instances = 8
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_lru_scan_depth = 2000
innodb_io_capacity = 2000
innodb_io_capacity_max = 4000
innodb_file_format = Barracuda
innodb_file_format_max = Barracuda
innodb_purge_threads = 4
innodb_large_prefix = 1
innodb_thread_concurrency = 64
innodb_print_all_deadlocks = 1
innodb_log_file_size = 1G
innodb_log_buffer_size = 16M
innodb_log_files_in_group = 2
innodb_file_per_table=1
innodb-strict-mode = 1
innodb_flush_log_at_trx_commit = 1
innodb_log_files_in_group = 3
innodb_flush_method = O_DIRECT
innodb_undo_directory=/mysql/3306/undolog
innodb_undo_logs = 128
innodb_undo_tablespaces = 3
# BINARY LOGGING #
log-bin = /mysql/3306/binlog/bin.log #binlog存放路径,需要根据实际情况修改
expire-logs-days = 7
sync-binlog = 1
binlog_format="ROW"
log_bin_trust_function_creators = 1
binlog_cache_size = 2097152
# LOGGING #
log-error = /mysql/3306/log/error.log #errorlog存放路径,需要根据实际情况修改
log-queries-not-using-indexes = 1
slow-query-log = 1
slow-query-log-file = /mysql/3306/log/slowquery.log #slowlog存放路径,需要根据实际情况修改
long_query_time = 2
min_examined_row_limit = 100
[mysqld-5.6]
# metalock performance settings
metadata_locks_hash_instances=64
[mysqld-5.7]
# new innodb settings #
loose_innodb_numa_interleave=1
innodb_buffer_pool_dump_pct = 40
innodb_page_cleaners = 6
innodb_undo_log_truncate = 1
innodb_max_undo_log_size = 2G
innodb_purge_rseg_truncate_frequency = 128