MySQL 在 Ubuntu 12.04 中不断崩溃

MySQL 在 Ubuntu 12.04 中不断崩溃

每隔几个小时,MySQL 就会在我的 Digital Ocean Ubuntu 12.04 机器上崩溃。以下是我在 MySQL 错误日志中看到的错误。我以为是内存问题,所以我添加了交换,但这并没有解决问题。

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

140806 11:58:58 [Note] /usr/sbin/mysqld: Shutdown complete

以下是我的内存情况 (free -m):

             total       used       free     shared    buffers     cached
Mem:          2003        384       1619          0         12         50
-/+ buffers/cache:        321       1682
Swap:          511         18        493

有人能帮我弄清楚如何阻止这种情况发生吗?

答案1

错误在日志中:

Fatal error: cannot allocate memory for the buffer pool

作为一个快速解决方案,您有 2 个选项:

  1. 为服务器添加更多 RAM,或者

  2. innodb-buffer-pool减少配置文件中的大小值:

    innodb_buffer_pool_size = 10M

相关内容