内存不足导致mysql无法启动
最近,朋友的博客经常挂,拜托我上去找下原因,最后发现mysql挂了导致的。
手动启动,发现启动不了,查看日志:
130629 5:46:48 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
130629 5:46:48 InnoDB: Completed initialization of buffer pool
130629 5:46:48 InnoDB: Fatal error: cannot allocate memory for the buffer pool
130629 5:46:48 [ERROR] Plugin 'InnoDB' init function returned error.
130629 5:46:48 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
130629 5:46:48 [ERROR] Unknown/unsupported storage engine: InnoDB
130629 5:46:48 [ERROR] Aborting
从日志中大概能看出内存的问题,百度了一下相关问题,果然是,网上说内存不足导致的,用free命令查看了验证了下,确实如此内存被消耗查不多了,并且系统未分配swap。
于是,解决思路就是增加swap:
……