Docs / Databases / How to Optimize MySQL Performance

How to Optimize MySQL Performance

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 152 views · 1 min read

Tuning MySQL configuration can dramatically improve database performance.

Key Settings

Edit /etc/mysql/mysql.conf.d/mysqld.cnf:

[mysqld]
# InnoDB buffer pool (set to 50-70% of available RAM)
innodb_buffer_pool_size = 512M

# Log file size
innodb_log_file_size = 128M

# Query cache (disable for write-heavy workloads)
query_cache_type = 0

# Max connections
max_connections = 100

# Temp table size
tmp_table_size = 64M
max_heap_table_size = 64M

# Slow query log
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow.log
long_query_time = 2

Apply

systemctl restart mysql

Monitor

mysqladmin -u root -p status
mysqladmin -u root -p processlist

Was this article helpful?