Skip to main content

MySQL Server RAM Optimization

Recommended server-side configuration to reduce MySQL memory usage. Adjust these in my.cnf (or equivalent) and restart MySQL.

InnoDB

Connections

Query / temporary tables

Query cache (MySQL 8+)

Query cache is removed in MySQL 8. If you are on MySQL 5.7 and use it, disable to avoid overhead:

Applying

  • Linux: Often /etc/mysql/my.cnf or /etc/my.cnf
  • macOS (Homebrew): $(brew --prefix mysql)/etc/my.cnf
  • Restart MySQL after changes.