I migrated a web site from one host to another and as such upgraded to MySQL 5.5 running on Ubuntu 12.04. Everything was moving along nicely until MySQL started to randomly crash.
Jul 23 07:06:38 domU-12-31-39-02-76-EA kernel: [236645.626405] init: mysql main process (21515) terminated with status 1 Jul 23 07:06:38 domU-12-31-39-02-76-EA kernel: [236645.626453] init: mysql main process ended, respawning Jul 23 07:06:39 domU-12-31-39-02-76-EA kernel: [236646.617559] init: mysql post-start process (21516) terminated with status 1
Trying to start the process using the service command yields this message:
Job failed to start
I found several sites recommending that I uninstall and re-install mysqld – which I did to no avail.
I finally tried to run mysqld manually from command line and found a bit more of a clue:
120723 7:40:29 [Note] Plugin 'FEDERATED' is disabled. 120723 7:40:29 InnoDB: The InnoDB memory heap is disabled 120723 7:40:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins 120723 7:40:29 InnoDB: Compressed tables use zlib 126.96.36.199 120723 7:40:29 InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(137363456 bytes) failed; errno 12 120723 7:40:29 InnoDB: Completed initialization of buffer pool 120723 7:40:29 InnoDB: Fatal error: cannot allocate memory for the buffer pool 120723 7:40:29 [ERROR] Plugin 'InnoDB' init function returned error. 120723 7:40:29 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 120723 7:40:29 [ERROR] Unknown/unsupported storage engine: InnoDB 120723 7:40:29 [ERROR] Aborting 120723 7:40:29 [Note] /usr/sbin/mysqld: Shutdown complete
Aha! Looks like something with the configuration of Innodb.
Checking some of these messages revealed that the default configuration for innodb_buffer_pool_size is 128M… for my small server this was simply too large.
From here, I simply modified /etc/mysql/my.cnf to include the following statement
innodb_buffer_pool_size = 16M
A much more reasonable number considering the size of my server memory. Now simply start your mysql server and you should be good to go!