MySQL Server Runs Out of Memory or Does Not Start

This guide explains how to fix issues when your MySQL server runs out of memory or fails to start.


Important

You must have root access to the server to follow these procedures.


Problem

When attempting to start MySQL, the server may:

  • Run out of memory

  • Fail to start completely


Resolution

The issue can usually be resolved by reducing MySQL’s memory usage. Modify the my.cnf configuration file and restart the server.


Steps

  1. Open the MySQL configuration file with a text editor (nano or vi):

nano /etc/my.cnf
  1. Add or modify the following lines (uncomment existing lines if necessary):

set-variable = max_allowed_packet=1M
set-variable = thread_stack=64K
set-variable = table_cache=4
set-variable = sort_buffer=64K
set-variable = net_buffer_length=2K
set-variable = key_buffer_size=2095104
skip-innodb
skip-networking
skip-bdb
skip-ndbcluster
  1. Save the changes to my.cnf.

  2. Restart the MySQL server:

  • AlmaLinux / Fedora:

service mysqld restart
  • Debian / Ubuntu:

service mysql restart

After restarting, MySQL should run with reduced memory usage, resolving startup or memory issues.

Помог ли вам данный ответ? 0 Пользователи нашли это полезным (0 голосов)

Powered by WHMCompleteSolution