How to Avoid MySQL Service Being Killed by Out-of-Memory (OOM) Killer on Linux (Doc ID 1548124.1)

Last updated on JANUARY 18, 2017

Applies to:

MySQL Server - Version 5.0 and later
Information in this document applies to any platform.

Goal

How to avoid MySQL getting killed by the Out-of-Memory (OOM) killer on Linux.

Example of issue:

Mysqld restarts periodically by mysqld_safe but no errors in mysql error log just message that mysqld_safe restarted mysqld. Caused by Linux Out Memory Killer killing mysqld process.
Can be verified by the examining system logs. Entries like below:

shell$ egrep -i "err|fail|fault|mysql|kill" /var/log/*
"var/log/messages-20170108:Jan 7 21:55:30 ktsk kernel: Out of memory: Kill process 1904 (mysqld) score 39 or sacrifice child
/var/log/messages-20170108:Jan 7 21:55:30 ktsk kernel: Killed process 1904 (mysqld) total-vm:2855024kB, anon-rss:449640kB, file-rss:0kB
/var/log/messages-20170108:Jan 7 21:55:58 ktsk kernel: httpd invoked oom-killer: gfp_mask=0x200da, order=0, oom_score_adj=0"

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms