MySQL falling for lack of memory

6

I have a dedicated Linux Ubuntu 12.04 LTS server with MySQL / Apache / Wordpress , but since it only has 1Gb of RAM, sometimes it drops out of memory . In the syslog mark with the message

  

Out of memory: Kill process XXXXX (mysqld) score XXXXXX or sacrifice child

and then

  

mysql respawning too fast, stopped

Is there a solution for the MySQL daemon to keep trying, but at longer intervals (like 5 minutes)?

** Update:

/etc/mysql/my.cnf: link

    
asked by anonymous 13.02.2014 / 20:00

1 answer

5

Check the maximum amount of memory your server could theoretically use

Use the MySQLTuner script, available at link , and follow its recommendations. It will already tell you how much memory your database could use in a stressful time. Make sure it is smaller than you actually have, or at least check if you have swap enabled.

SWAP

In addition to configuring your MySQL to use less memory, something that should always be done in small virtual machines is to create SWAP. A database running in SWAP is not a good idea, but at least your application will not stop for lack of memory.

link explains how to do this process with CentOS.

Run the

sudo swapon -s

and see if it returns a value with SWAP size. If it does not return, it must be created.

    
13.02.2014 / 21:10