新购的一台阿里云主机,几乎每天都会发生MySQL自动停止服务。主机其他部分看来运行都正常,怀疑是哪里设置的不对,但我装完这台LNMP改的默认设置不多,之前也并没有碰到过类似的问题。既然是MySQL停止服务,那么就从MySQL这里找问题,搜索了一个多小时,发现MySQL宕机有很多可能性,一时无法确定。但解决此类问题的关键都是查看错误日志开始。
命令行进入本地MySQL,之后输入密码
mysql -hlocalhost -uroot -p
之后进入提示符mysql>
查看错误日志的位置
mysql> show variables like '%log_error%';
此时获取到了文件位置。查看日志后,发现大部分重复片段是这样的:
2017-07-26 04:34:03 7617 [Note] Plugin 'FEDERATED' is disabled.
2017-07-26 04:34:03 7617 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-07-26 04:34:03 7617 [Note] InnoDB: The InnoDB memory heap is disabled
2017-07-26 04:34:03 7617 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-07-26 04:34:03 7617 [Note] InnoDB: Memory barrier is not used
2017-07-26 04:34:03 7617 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-07-26 04:34:03 7617 [Note] InnoDB: Using CPU crc32 instructions
2017-07-26 04:34:03 7617 [Note] InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
2017-07-26 04:34:03 7617 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2017-07-26 04:34:03 7617 [ERROR] Plugin 'InnoDB' init function returned error.
2017-07-26 04:34:03 7617 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-07-26 04:34:03 7617 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-07-26 04:34:03 7617 [ERROR] Aborting
查看详细 »