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
有人可以帮我弄清楚如何阻止这种情况发生吗?
错误在日志中:
Fatal error: cannot allocate memory for the buffer pool
作为快速解决方案,您有2个选项:
- 添加更多RAM到服务器,或
-
减少配置文件中
innodb-buffer-pool
大小的值:innodb_buffer_pool_size = 10M