Enable mysql caching and prevent crash
Left to their own devices, Databases do not consume vast amounts of CPU and memory.
However, they will do so, quite happily, if asked to do so on behalf of poorly-written or poorly-performing queries.
I suspect what's happened here is that you turned on cacheing, which requires additional memory for the mysql instance which, in turn, woke the "dragon" that is the machine's Out of Memory Manager and that killed your mysql instance stone dead!
Look first to fixing the poorly performing queries, not at the database or the server on which they're running. Get the Execution (Explain) Plan for those queries and tune them. I often find that it takes just a handful of errant queries to cause a huge impact on the database.
Here's something I [all too] regularly horrify Developers with:
- A DBA spending several days mucking about with database and server settings might possibly get you ...
Two or three percentage points improvement in performance. - A Developer spending several days tuning a handful of errant queries would probably get you ...
Two or three Orders of Magnitude improvement in performance.