Study case: "InnoDB: Database was not shutdown normally! "
The out-of-memory killer would choose mysql to close down, because it was (usually) the biggest memory user in the system.
The command to sort down processes by memory usage:
ps aux --sort -rss | head -n15
Solution:
/etc/mysql/my/cnf
[mysqld]
performance_schema=0