Files
2025-10-05 09:21:04 +07:00

44 lines
1.7 KiB
INI

[mysqld]
# ==== Charset / Collation ====
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
skip-character-set-client-handshake
# ==== InnoDB Core ====
innodb_file_per_table = 1
innodb_buffer_pool_size = 4G # ปรับตามโหลดจริงภายหลังได้
innodb_flush_method = O_DIRECT # ลด double buffering บน ext4
innodb_flush_log_at_trx_commit = 1 # 1 ปลอดภัยสุด; ถ้ารับความเสี่ยงได้ ใช้ 2 เพื่อเร็วขึ้น
innodb_log_file_size = 1G # เปลี่ยนขนาด redo log (ต้อง restart)
# ==== Connections / Memory ====
max_connections = 200
thread_cache_size = 100
table_open_cache = 4096
# ==== SQL Mode & Limits ====
sql_mode = STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
max_allowed_packet = 128M
# ==== Temps ====
tmp_table_size = 256M
max_heap_table_size = 256M
# ==== Timezone ====
default-time-zone = '+07:00'
# ==== Networking ====
skip-name-resolve = 1
# ==== Logging (แนะนำช่วงแรก) ====
slow_query_log = 1
slow_query_log_file = /var/lib/mysql/slow.log
long_query_time = 1
log_slow_admin_statements = 1
log_queries_not_using_indexes = 0 # เปิดเป็น 1 ชั่วคราวได้ แต่จะ noisy
# ==== Binary Log (ถ้าไม่ใช้รีพลิเคชัน ปิดไว้) ====
# log_bin = OFF
# บังคับใช้ Linux AIO แบบ libaio (ไม่พยายาม io_uring)
innodb_linux_aio = aio