参数名称参数说明参考max_connections数据库的最大连接数MySQL :: MySQL 8.0 Reference Manual :: 5.1.8 Server System Variableswait_timeout非交互模式的没有操作后的超时秒数,超时后数据库会关闭该连接。MySQL :: MySQL 8.0 Reference Manual :: 5.1.8 Server System Variablesinteractive_timeout交互模式下的没有操作后的超时时间,一般与wait_timeout的值一致MySQL :: MySQL 8.0 Reference Manual :: 5.1.8 Server System Variablesmax_prepared_stmt_count限制一个session内最多可以有多少条预编译语句MySQL :: MySQL 8.0 Reference Manual :: 5.1.8 Server System Variablesinnodb_lock_wait_timeout等待数据锁的超时时间默认50s,超时则回滚当前事务,可以设置适当的时长作为避免死锁的一种措施MySQL :: MySQL 8.0 Reference Manual :: 15.14 InnoDB Startup Options and System Variablesmax_allowed_packet服务器和客户之间单次通信的大小上限,会限制Server接受的数据包大小。MySQL :: MySQL 8.0 Reference Manual :: 5.1.8 Server System Variablesslow_query_log是否开启慢日志 0关闭, 1开启MySQL :: MySQL 8.0 Reference Manual :: 5.1.8 Server System Variableslong_query_time如果开启了慢日志,则sql查询时间超过该值就记录到慢日志MySQL :: MySQL 8.0 Reference Manual :: 5.1.8 Server System Variablesinnodb_flush_log_at_trx_commit控制提交操作的严格ACID合规性与在批量重新安排和完成提交相关I/O操作时可能实现的更高性能之间的平衡。 完全符合ACID要求需要默认设置1。日志在每次事务提交时写入并刷新到磁盘。 设置为0时,日志每秒写入并刷新到磁盘一次。未刷新日志的事务可能会在崩溃中丢失。 设置为2时,日志在每次事务提交后写入,并每秒刷新一次到磁盘。未刷新日志的事务可能会在崩溃中丢失。MySQL :: MySQL 8.0 Reference Manual :: 15.14 InnoDB Startup Options and System Variablessync_binlog控制MySQL服务器将二进制日志同步到磁盘的频率。 sync_binlog=0:禁用MySQL服务器将二进制日志同步到磁盘。 sync_binlog=1:启用在提交事务之前将二进制日志同步到磁盘。 sync_binlog=其他数字,表示在收集N个二进制日志提交组后,二进制日志将同步到磁盘。MySQL :: MySQL 8.0 Reference Manual :: 17.1.6.4 Binary Logging Options and Variablesinnodb_buffer_pool_instancesInnoDB缓冲池划分的区域数。仅在缓冲区大于1G时生效,默认为8MySQL :: MySQL 8.0 Reference Manual :: 15.14 InnoDB Startup Options and System Variablesinnodb_buffer_pool_chunk_size缓冲池的块大小(字节)默认128MMySQL :: MySQL 8.0 Reference Manual :: 15.14 InnoDB Startup Options and System Variablesinnodb_buffer_pool_size缓冲池的大小(字节),InnoDB缓存表和索引数据的内存区域。缓冲池大小必须始终等于或是innodb_Buffer_pool_chunk_size*innodb_buffer_pool_instances的倍数MySQL :: MySQL 8.0 Reference Manual :: 15.14 InnoDB Startup Options and System Variables