MySQL server crashes at least 2 times a week

I have a client that I do web development for who has a server running Ubuntu 12.x with PHP and MySQL.

MY problem is randomly it seems, about 2 times a week I get a call saying the MySQL server is down in which case I login and restart MySQL and then everything runs fine for a few days until it happens again.

This time I looked at this log file...

/var/log/mysql/error.log

The error.log contents are below. Can anyone tell me what might be happening and how I could fix?

151117  0:19:26 [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.
151117  0:19:26 [Note] Plugin 'FEDERATED' is disabled.
151117  0:19:26 InnoDB: The InnoDB memory heap is disabled
151117  0:19:26 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151117  0:19:26 InnoDB: Compressed tables use zlib 1.2.8
151117  0:19:26 InnoDB: Using Linux native AIO
151117  0:19:26 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
151117  0:19:26 InnoDB: Completed initialization of buffer pool
151117  0:19:26 InnoDB: Fatal error: cannot allocate memory for the buffer pool
151117  0:19:26 [ERROR] Plugin 'InnoDB' init function returned error.
151117  0:19:26 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151117  0:19:26 [ERROR] Unknown/unsupported storage engine: InnoDB
151117  0:19:26 [ERROR] Aborting

151117  0:19:26 [Note] /usr/sbin/mysqld: Shutdown complete

151117  0:19:27 [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.
151117  0:19:27 [Note] Plugin 'FEDERATED' is disabled.
151117  0:19:27 InnoDB: The InnoDB memory heap is disabled
151117  0:19:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins
151117  0:19:27 InnoDB: Compressed tables use zlib 1.2.8
151117  0:19:27 InnoDB: Using Linux native AIO
151117  0:19:27 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
151117  0:19:27 InnoDB: Completed initialization of buffer pool
151117  0:19:27 InnoDB: Fatal error: cannot allocate memory for the buffer pool
151117  0:19:27 [ERROR] Plugin 'InnoDB' init function returned error.
151117  0:19:27 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151117  0:19:27 [ERROR] Unknown/unsupported storage engine: InnoDB
151117  0:19:27 [ERROR] Aborting

151117  0:19:27 [Note] /usr/sbin/mysqld: Shutdown complete

Solution 1:

... InnoDB: mmap(137363456 bytes) failed; errno 12
...
151117 0:19:27 InnoDB: Fatal error: cannot allocate memory for the buffer pool

Looks like you run out of memory - add more or tune your innodb parameters so it uses less.