MariaDB (MySQL) Out of Memory Issue

Troubleshoot [ERROR] mysqld: Out of memory (Needed ###### bytes)

  1. MySQL tries to allocate more memory than it has available to do so set to the default innodb_buffer_pool_size specification (default value 128MB). When the system runs out of memory, it starts to kill processes to free up RAM.
    • Check your mysql log file (/etc/logging/mariadb/mariadb.log or check my.cnf for your logging information)
      • my.cnf can be in several locations, from my experience /etc/mysql/my.cnf is the usual spot but other locations may include;
        • /etc/my.cnf
          /etc/mysql/my.cnf
          /usr/etc/my.cnf
          ~/.my.cnf
      • add the following line to the my.cnf file.
        • innodb_buffer_pool_size= [desired amount 256M / 1G]
  2. There are other processes on the server that have a heavy allocation of RAM.
    • Check using “free -g” , “cat /proc/meminfo” , “top” , “htop”, or ” ps ax” command for performance problems
  3. Memory leak in MySQL.

After change conduct

sudo service mysqld stop
sudo service mysqld start

Leave a Reply

Your email address will not be published. Required fields are marked *