MYsql经常无缘无故关闭,之后无法重启

时间:2015-05-05 10:32:08

标签: mysql error-handling

150505 16:57:01 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
150505 16:58:01 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150505 16:58:01 [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.
150505 16:58:01 [Note] Plugin 'FEDERATED' is disabled.
150505 16:58:01 InnoDB: The InnoDB memory heap is disabled
150505 16:58:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
150505 16:58:01 InnoDB: Compressed tables use zlib 1.2.8
150505 16:58:01 InnoDB: Using Linux native AIO
150505 16:58:01 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
150505 16:58:01 InnoDB: Completed initialization of buffer pool
150505 16:58:01 InnoDB: Fatal error: cannot allocate memory for the buffer pool
150505 16:58:01 [ERROR] Plugin 'InnoDB' init function returned error.
150505 16:58:01 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150505 16:58:01 [ERROR] Unknown/unsupported storage engine: InnoDB
150505 16:58:01 [ERROR] Aborting

上面是mysql错误日志,有时候mysql会崩溃,而我想在服务上重启,它就无法启动,错误就像是 "未知实例"错误。

任何人都知道上面的错误是什么以及如何解决它,我试过google但似乎无法找到答案。

谢谢!

1 个答案:

答案 0 :(得分:1)

我发现这个问题自己寻找答案,我的服务器/var/log/mysql/error.log与你的声明非常相似。运行dmesg | tail -20揭示了罪魁祸首:操作系统内存耗尽并导致mysqld被杀:

[835661.446277] Out of memory: Kill process 1024 (mysqld) score 91 or sacrifice child
[835661.446912] Killed process 1024 (mysqld) total-vm:901544kB, anon-rss:92332kB, file-rss:0kB
[835661.488337] init: mysql main process (1024) killed by KILL signal

现在要弄清楚为什么内存耗尽,在这台新服务器上,RAM的数量是它替换它的两倍,从来没有这样做......