Mysql 5.7 配置


[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
character_set_server=utf8mb4
lower_case_table_names=0
skip_name_resolve
max_allowed_packet             = 128M
max_connections = 100000
max_connect_errors = 1000000

wait_timeout                   = 3600
tmp_table_size                 = 32M
max_heap_table_size            = 32M
query_cache_type               = 0
query_cache_size               = 0
thread_cache_size              = 100
open_files_limit               = 65535
table_definition_cache         = 1024
table_open_cache               = 20480

innodb_flush_method            = O_DIRECT
innodb_log_files_in_group      = 2
innodb_log_file_size           = 2G
innodb_flush_log_at_trx_commit = 2
innodb_file_per_table          = 1
innodb_buffer_pool_size        = 5G
innodb_thread_concurrency      = 8
innodb_buffer_pool_instances   = 9
metadata_locks_hash_instances   = 256
innodb_io_capacity              = 4000
innodb_io_capacity_max          = 6000
innodb_lru_scan_depth           = 2000
innodb_write_io_threads         = 40
innodb_read_io_threads          = 60

# Disabling symbolic_links is recommended to prevent assorted security risks
symbolic_links=0
sql_mode=STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
log_error=/var/log/mysqld.log
pid_file=/var/run/mysqld/mysqld.pid