根据服务器规格生成 my.cnf 配置,内置参数搜索与调优建议
[mysqld] # ============================ # MySQL 8.0 配置 — 自动生成 # 规格: 4 Core / 16GB RAM / SSD / OLTP # ============================ # --- 基础设置 --- server_id = 1 port = 3306 character_set_server = utf8mb4 collation_server = utf8mb4_0900_ai_ci skip_name_resolve = ON lower_case_table_names = 1 default_storage_engine = InnoDB # --- 连接设置 --- max_connections = 200 max_connect_errors = 100000 thread_cache_size = 30 interactive_timeout = 1200 wait_timeout = 600 # --- 表缓存 --- table_open_cache = 2000 table_definition_cache = 2000 open_files_limit = 65535 # --- InnoDB 缓冲池 --- innodb_buffer_pool_size = 11G innodb_buffer_pool_instances = 11 innodb_file_per_table = ON innodb_open_files = 2000 # --- InnoDB 日志 --- innodb_log_file_size = 1024M innodb_log_buffer_size = 64M innodb_flush_log_at_trx_commit = 1 sync_binlog = 1 innodb_flush_method = O_DIRECT # --- InnoDB I/O --- innodb_io_capacity = 4000 innodb_io_capacity_max = 8000 innodb_read_io_threads = 4 innodb_write_io_threads = 4 innodb_thread_concurrency = 0 # --- 会话内存 --- sort_buffer_size = 512K join_buffer_size = 512K read_buffer_size = 512K read_rnd_buffer_size = 512K tmp_table_size = 64M max_heap_table_size = 64M # --- 锁与死锁 --- innodb_lock_wait_timeout = 20 innodb_print_all_deadlocks = ON innodb_deadlock_detect = ON # --- 慢查询日志 --- slow_query_log = ON slow_query_log_file = /var/log/mysql/slow.log long_query_time = 1 log_queries_not_using_indexes = OFF # --- 二进制日志 --- log_bin = mysql-bin binlog_format = ROW binlog_expire_logs_seconds = 604800 max_binlog_size = 256M # --- 监控 --- performance_schema = ON
根据 CPU、内存、磁盘类型和负载模式自动计算最优参数
适配 MySQL 5.7、8.0、8.4 版本差异
内置 40+ 常用参数说明、默认值与调优建议
预置开发/测试/生产常用服务器规格,一键应用