mysql crashes have to be restarted for it to work

July 8, 2014 2.4k views

Hey guys, i have a cloud 20GB plan its setup with nignx server and i have just one website hosted over it.

Its a wordpress based website and uses mysql for db. The traffic is not much just 200 to 500 visitors per day.

Its been 2 weeks (a little more) and mysql has crashed 3-4 times so far. Now i am bit worried about it as its a site which deals with e-comm hence i want to find a solution and a reason for it.

here is the error log:

140707 23:37:13 mysqld_safe Number of processes running now: 0
140707 23:37:13 mysqld_safe mysqld restarted
140707 23:37:13 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be rem
oved in a future release. Please use the full name instead.
140707 23:37:13 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and
will be removed in a future release. Please use the full name instead.
140707 23:37:13 [Note] Plugin 'FEDERATED' is disabled.
140707 23:37:13 InnoDB: The InnoDB memory heap is disabled
140707 23:37:13 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140707 23:37:13 InnoDB: Compressed tables use zlib 1.2.8
140707 23:37:13 InnoDB: Using Linux native AIO
140707 23:37:13 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140707 23:37:13 InnoDB: Completed initialization of buffer pool
140707 23:37:13 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140707 23:37:13 [ERROR] Plugin 'InnoDB' init function returned error.
140707 23:37:13 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140707 23:37:13 [ERROR] Unknown/unsupported storage engine: InnoDB
140707 23:37:13 [ERROR] Aborting

140707 23:37:13 [Note] /usr/sbin/mysqld: Shutdown complete

140707 23:37:13 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
140707 23:56:08 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

Its crashed on 23:37 and i restarted it on 23:56 thats 19 mins of down time :(

3 Answers

The key error here is:

140707 23:37:13 InnoDB: Fatal error: cannot allocate memory for the buffer pool

This crash is due to your system running out of memory. I'd suggest that you add a swap file to give yourself a bit more of a buffer. Check out this tutorial:

How To Add Swap on Ubuntu 14.04

by Justin Ellingwood
Swap space can be used as an "overflow" area for your system when you run out of RAM. The operating system can store data that would normally be kept in RAM on the hard drive in a specially formatted file. In this guide, we'll demonstrate how to create and use one of these files in Ubuntu 14.04.

same thing happening with websites also..

Thanks Andrew for that helpfull tutorial, if in case i have to increase the memory how much should i increase? and can i just increase the RAM size of the vps?

P.S i dont get any notification when you post answer on this should i get it or i have to enable any option?

  • It's not possible to increase a droplet's RAM size independently of its other specs. I would suggest upgrading to the next plan.

    Notifications aren't supported at the moment but we're working on that and they should be available soon.

Have another answer? Share your knowledge.