[client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld] # 基本参数 port = 3306 socket = /var/run/mysqld/mysqld.sock pid-file = /var/run/mysqld/mysqld.pid user = mysql basedir = /usr datadir = /var/lib/mysql skip-name-resolve default-time-zone = '+08:00' default_authentication_plugin = mysql_native_password character-set-server = utf8mb4 open_files_limit = 65535 back_log = 512 max_connections = 800 max_connect_errors = 100000 table_open_cache = 2048 table_definition_cache = 2048 table_open_cache_instances = 8 lower_case_table_names = 1 thread_stack = 512K external-locking = FALSE max_allowed_packet = 32M sort_buffer_size = 4M join_buffer_size = 4M read_buffer_size = 2M read_rnd_buffer_size = 4M thread_cache_size = 128 interactive_timeout = 7200 wait_timeout = 7200 tmp_table_size = 64M max_heap_table_size = 64M slow_query_log = 1 slow_query_log_file = /var/log/mysql/slow.log log-error = /var/log/mysql/error.log long_query_time = 3 log_queries_not_using_indexes = 0 min_examined_row_limit = 1000 log_slow_admin_statements = 1 log_slow_slave_statements = 1 log_timestamps = SYSTEM server-id = 1 log-bin = mysql-bin sync_binlog = 1 binlog_cache_size = 4M max_binlog_cache_size = 1G max_binlog_size = 512M binlog_expire_logs_seconds = 604800 master_info_repository = TABLE relay_log_info_repository = TABLE gtid_mode = on enforce_gtid_consistency = 1 log_slave_updates = 1 slave_rows_search_algorithms = INDEX_SCAN,HASH_SCAN binlog_format = row binlog_checksum = CRC32 relay_log_recovery = 1 relay_log_purge = 1 key_buffer_size = 16M bulk_insert_buffer_size = 32M myisam_sort_buffer_size = 64M myisam_max_sort_file_size = 10G lock_wait_timeout = 3600 innodb_thread_concurrency = 0 innodb_sync_spin_loops = 100 innodb_spin_wait_delay = 30 transaction_isolation = REPEATABLE-READ innodb_buffer_pool_size = 10G innodb_buffer_pool_instances = 4 innodb_buffer_pool_load_at_startup = 1 innodb_buffer_pool_dump_at_shutdown = 1 innodb_flush_log_at_trx_commit = 1 innodb_log_buffer_size = 32M innodb_redo_log_capacity = 4G innodb_max_undo_log_size = 2G innodb_io_capacity = 2000 innodb_io_capacity_max = 4000 innodb_flush_neighbors = 0 innodb_write_io_threads = 4 innodb_read_io_threads = 4 innodb_purge_threads = 4 innodb_page_cleaners = 4 innodb_open_files = 65535 innodb_max_dirty_pages_pct = 50 innodb_flush_method = O_DIRECT innodb_lru_scan_depth = 2000 innodb_checksum_algorithm = crc32 innodb_lock_wait_timeout = 10 innodb_rollback_on_timeout = 1 innodb_print_all_deadlocks = 1 innodb_file_per_table = 1 innodb_online_alter_log_max_size = 4G innodb_stats_on_metadata = 0 [mysqldump] quick max_allowed_packet = 32M