MySQL configuration settings
System variables. Read them with SHOW VARIABLES or performance_schema, change dynamic ones with SET GLOBAL or SET PERSIST, and stage read-only ones with SET PERSIST_ONLY before a restart. MySQL 8.4 changed several InnoDB defaults; each page says which.
Inspect what your server runs with
SHOW GLOBAL VARIABLES LIKE 'innodb_buffer_pool_size'; SELECT VARIABLE_NAME, VARIABLE_SOURCE, VARIABLE_PATH, SET_TIME FROM performance_schema.variables_info WHERE VARIABLE_SOURCE <> 'COMPILED';
No setting matched. Try a topic such as memory, log or timeout.
메모리
Caches, per-query work memory and the ceiling on what the server takes from the OS.
| 설정 | 기본값 | Restart | 기능 |
|---|---|---|---|
innodb_buffer_pool_size |
128MB |
아니요 | Size of InnoDB's cache for table and index pages. |
innodb_buffer_pool_instances |
1 (computed) |
예 | Number of separate regions the buffer pool is split into. |
innodb_dedicated_server |
OFF |
예 | Let InnoDB size the buffer pool and redo log from the server's memory and CPU count. |
tmp_table_size |
16MB |
아니요 | Largest in-memory internal temporary table before it converts to disk. |
max_heap_table_size |
16MB |
아니요 | Largest user-created MEMORY table. |
sort_buffer_size |
256KB |
아니요 | Memory each sort may use before it writes merge passes to disk. |
join_buffer_size |
256KB |
아니요 | Buffer for joins that cannot use an index, including hash joins. |
연결
How many sessions the server accepts and what each one costs.
| 설정 | 기본값 | Restart | 기능 |
|---|---|---|---|
max_connections |
151 |
아니요 | Maximum simultaneous client connections. |
thread_cache_size |
9 (autosized) |
아니요 | Threads kept for reuse after a client disconnects. |
table_open_cache |
4000 |
아니요 | Number of open table handles cached across all sessions. |
table_definition_cache |
2000 (autosized) |
아니요 | Number of table definitions cached. |
max_allowed_packet |
64MB |
아니요 | Largest single packet, and so the largest row, BLOB or statement, the server accepts. |
max_connect_errors |
100 |
아니요 | Failed connection attempts from one host before it is blocked. |
Parallelism & workers
Worker pools and how many CPUs one query may use.
| 설정 | 기본값 | Restart | 기능 |
|---|---|---|---|
innodb_parallel_read_threads |
Logical CPUs / 8, minimum 4 |
아니요 | Threads for parallel clustered index reads. |
replica_parallel_workers |
4 |
아니요 | Applier threads a replica uses to apply transactions in parallel. |
WAL, redo & durability
What a COMMIT waits for and how the change log is sized and written.
| 설정 | 기본값 | Restart | 기능 |
|---|---|---|---|
innodb_redo_log_capacity |
100MB |
아니요 | Total disk space for the InnoDB redo log. |
innodb_log_buffer_size |
64MB |
아니요 | Memory buffer for redo log records before they are written to disk. |
innodb_flush_log_at_trx_commit |
1 |
아니요 | When InnoDB writes and flushes the redo log for a commit. |
sync_binlog |
1 |
아니요 | How often the binary log is synced to disk. |
log_bin |
ON |
예 | Whether the binary log is enabled. |
binlog_expire_logs_seconds |
2592000 (30 days) |
아니요 | Age after which binary log files are purged automatically. |
Disk I/O
Flush rates, I/O threads and how the engine talks to the file system.
| 설정 | 기본값 | Restart | 기능 |
|---|---|---|---|
innodb_io_capacity |
10000 |
아니요 | Background I/O operations per second InnoDB aims for when flushing pages and merging. |
innodb_io_capacity_max |
2 x innodb_io_capacity (20000) |
아니요 | Upper limit on background I/O when InnoDB falls behind on flushing. |
innodb_flush_method |
O_DIRECT on Linux |
예 | How InnoDB opens and flushes data and log files. |
innodb_flush_neighbors |
0 |
아니요 | Whether flushing a page also flushes adjacent dirty pages in the same extent. |
innodb_read_io_threads |
Logical CPUs / 2, minimum 4 |
예 | Background threads for read-ahead and other InnoDB read I/O. |
innodb_write_io_threads |
4 |
예 | Background threads for InnoDB write I/O. |
innodb_page_cleaners |
= innodb_buffer_pool_instances |
예 | Threads that flush dirty pages from the buffer pool. |
innodb_change_buffering |
none |
아니요 | Whether InnoDB buffers changes to secondary index pages that are not in memory. |
Vacuum, statistics & maintenance
Background cleanup and the statistics the planner relies on.
| 설정 | 기본값 | Restart | 기능 |
|---|---|---|---|
innodb_purge_threads |
1 or 4 |
예 | Threads that remove delete-marked rows and old undo records. |
Query planner
Cost model and plan-shape switches.
| 설정 | 기본값 | Restart | 기능 |
|---|---|---|---|
innodb_adaptive_hash_index |
OFF |
아니요 | Build in-memory hash indexes on hot B-tree pages automatically. |
Timeouts
Limits on statements, lock waits and idle sessions.
| 설정 | 기본값 | Restart | 기능 |
|---|---|---|---|
wait_timeout |
28800 (8 hours) |
아니요 | Seconds a non-interactive connection may sit idle before the server closes it. |
interactive_timeout |
28800 (8 hours) |
아니요 | Idle timeout for interactive clients such as the mysql command-line client. |
innodb_lock_wait_timeout |
50 |
아니요 | Seconds an InnoDB transaction waits for a row lock before giving up. |
lock_wait_timeout |
31536000 (1 year) |
아니요 | Seconds to wait for a metadata lock (DDL, LOCK TABLES, FLUSH TABLES). |
max_execution_time |
0 (disabled) |
아니요 | Milliseconds after which a read-only SELECT is aborted; 0 disables. |
Logging & diagnostics
What gets logged and which runtime statistics are collected.
| 설정 | 기본값 | Restart | 기능 |
|---|---|---|---|
slow_query_log |
OFF |
아니요 | Whether the slow query log is written. |
long_query_time |
10 |
아니요 | Seconds a statement must run to be written to the slow query log. |
log_slow_extra |
OFF |
아니요 | Add extra fields such as rows sent, bytes and temporary table counts to slow log entries. |
innodb_print_all_deadlocks |
OFF |
아니요 | Write every InnoDB deadlock to the error log. |
performance_schema |
ON |
예 | Enable the Performance Schema instrumentation. |
Temporary storage
Internal temporary tables, tempdb and spill space.
| 설정 | 기본값 | Restart | 기능 |
|---|---|---|---|
temptable_max_ram |
3% of RAM, 1GB to 4GB |
아니요 | Total RAM the TempTable engine may use for internal temporary tables before spilling. |
SQL behavior
Settings that change query results or locking semantics, not just speed.
| 설정 | 기본값 | Restart | 기능 |
|---|---|---|---|
sql_mode |
ONLY_FULL_GROUP_BY, STRICT_TRANS_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_ENGINE_SUBSTITUTION |
아니요 | SQL syntax and validation rules, as a comma-separated list of modes. |
transaction_isolation |
REPEATABLE-READ |
아니요 | Default transaction isolation level. |
innodb_deadlock_detect |
ON |
아니요 | Detect deadlocks immediately and roll back one of the transactions. |
innodb_autoinc_lock_mode |
2 |
예 | Locking used to generate AUTO_INCREMENT values. |
Security & access
Network exposure and features that widen the attack surface.
| 설정 | 기본값 | Restart | 기능 |
|---|---|---|---|
skip_name_resolve |
OFF |
예 | Do not resolve client host names; match accounts by IP address only. |
MySQL configuration FAQ
What is the difference between SET GLOBAL and SET PERSIST?
SET GLOBAL changes the running value and is lost on restart. SET PERSIST changes it and also writes it to mysqld-auto.cnf in the data directory, so it survives a restart. SET PERSIST_ONLY writes the file without touching the running value, which is how you change a read-only variable.
Which InnoDB defaults changed in MySQL 8.4?
Among others: innodb_io_capacity went from 200 to 10000, innodb_log_buffer_size from 16MB to 64MB, innodb_adaptive_hash_index from ON to OFF, innodb_change_buffering from all to none, and innodb_flush_method to O_DIRECT where the platform supports it. Thread-count defaults now scale with the number of logical processors.
How do I find variables someone has changed?
performance_schema.variables_info has VARIABLE_SOURCE: COMPILED means untouched, DYNAMIC means changed at runtime with SET GLOBAL, PERSISTED means from mysqld-auto.cnf, and the remaining values point at an option file or the command line.
The full list is in the MySQL manual. Other engines: PostgreSQL, SQL Server, Oracle, SQLite.
Related on SQLly
Run these queries against your own server
SQLly connects to MySQL and the other engines in this reference from one desktop app on macOS, Windows and Linux, with a results grid you can sort, filter and export.