mysql crashes have to be restarted for it to work

Posted July 8, 2014 4.5k 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/ 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 :(

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

4 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.


What you can also do is to use the MySQLTuner script.

The MySQLTuner is a script written in Perl and allows you to quickly test your MySQL configuration and it gives you suggestions for adjustments to increase performance and stability.

According to the official GitHub page, it supports 300 indicators for MySQL/MariaDB/Percona Server in this last version.

To run the script you could do the following:

  • SSH to your Droplet
  • Download the script:
wget -O
  • Then execute it:

The script would run multiple checks against your MySQL instance, all checks done by MySQLTuner are documented here.

Also as stated in the official documentation, it is still extremely important for you to fully understand each change you make to a MySQL database server. If you don’t understand portions of the script’s output, or if you don’t understand the recommendations, you should consult a knowledgeable DBA or system administrator that you trust.

As a good practice make sure to always test your changes on staging environments before implementing them on your production database.

On the same note, if you want to have a worry-free MySQL hosting and focus on your application, I would recommend trying out the DigitalOcean Managed Databases:

This was mini tutorial was posted from @bobbyiliev in this question in our community:

Hope that this helps!

Submit an Answer