多个请求关闭 MySQL

多个请求关闭 MySQL

我的 MySQL 数据库遇到了一些问题。

我配置了带有数据库和其他服务(apache,php)的服务器,并运行了多个应用程序。有两个问题:

  1. 每天同一时间 MySQL 都会出现故障,我必须去重新启动它。
  2. 每次我重新加载网站时,MySQL 都会连续失败,而且我又需要重新启动它。

MySQL 日志显示:

140107  0:09:29 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use$
140107  0:09:29 [Note] Plugin 'FEDERATED' is disabled.
140107  0:09:29 InnoDB: The InnoDB memory heap is disabled
140107  0:09:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140107  0:09:29 InnoDB: Compressed tables use zlib 1.2.3.4
140107  0:09:29 InnoDB: Initializing buffer pool, size = 64.0M
InnoDB: mmap(68681728 bytes) failed; errno 12
140107  0:09:29 InnoDB: Completed initialization of buffer pool
140107  0:09:29 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140107  0:09:29 [ERROR] Plugin 'InnoDB' init function returned error.
140107  0:09:29 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140107  0:09:29 [ERROR] Unknown/unsupported storage engine: InnoDB
140107  0:09:29 [ERROR] Aborting
140107  0:09:29 [Note] /usr/sbin/myqld: Shutdown complete

我该如何解决?

答案1

InnoDB: mmap(68681728 bytes) failed; errno 12

---

$ perror 12
OS error code  12:  Cannot allocate memory

您的内存已用完。如果可能,请为服务器添加更多 RAM。否则,您应该调整数据库设置以减少内存使用量。交换只会导致性能下降。要查看使用了多少内存,请free在控制台运行该命令。

更多信息可以参见此 Stack Overflow 线程:MySQL 最大内存使用量

相关内容