> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MySQL server runs out of memory or does not start

> Discover solutions for MySQL memory issues and startup problems with this guide featuring code snippets, instructions, and related articles.

This article describes how to resolve a problem that may occur when you try to run MySQL server with a limited amount of memory.

<Warning>
  **Important**

  You must have root access to the server to follow the procedures in this article.
</Warning>

## Problem

When you try to run MySQL server, it either runs out of memory or does not start at all.

## Resolution

You can resolve this problem by reducing the amount of memory that MySQL uses. To do this, modify the *my.cnf* configuration file and restart the MySQL server as follows:

1. Use the *nano* or *vi* text editor to open the */etc/my.cnf* file.

2. Make the following changes to the *my.cnf* file. You may need to add some of these lines, or uncomment existing lines by removing the leading **#**.

```
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
```

3. Save the changes to the *my.cnf* file.

4. Restart MySQL server. To do this, type the appropriate command for your Linux distribution:

   * For AlmaLinux and Fedora, type:

     ```bash theme={null}
     service mysqld restart
     ```

   * For Debian and Ubuntu, type:

     ```bash theme={null}
     service mysql restart
     ```

## Related articles

* [Connecting to MySQL from the command line](/docs/connect-to-mysql-from-the-command-line)

* [Managing MySQL databases, users, and tables from the command line](/docs/managing-mysql-databases-and-users-from-the-command-line)
