【数据库】InnoDB: Fatal error: cannot allocate memory for the buffer pool

时间:2025-02-20 07:29:19

错误日志

 

161208 12:32:45 mysqld_safe mysqld from pid file /alidata/server/mysql/data/ ended
161208 12:46:25 mysqld_safe Starting mysqld daemon with databases from /alidata/server/mysql/data
161208 12:46:25 [Note] Plugin 'FEDERATED' is disabled.
161208 12:46:25 InnoDB: The InnoDB memory heap is disabled
161208 12:46:25 InnoDB: Mutexes and rw_locks use GCC atomic builtins
161208 12:46:25 InnoDB: Compressed tables use zlib 1.2.3
161208 12:46:25 InnoDB: Using Linux native AIO
161208 12:46:25 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
161208 12:46:25 InnoDB: Completed initialization of buffer pool
161208 12:46:25 InnoDB: Fatal error: cannot allocate memory for the buffer pool
161208 12:46:25 [ERROR] Plugin 'InnoDB' init function returned error.
161208 12:46:25 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
161208 12:46:25 [ERROR] Unknown/unsupported storage engine: InnoDB
161208 12:46:25 [ERROR] Aborting

161208 12:46:25 [Note] /alidata/server/mysql/bin/mysqld: Shutdown complete

161208 12:46:25 mysqld_safe mysqld from pid file /alidata/server/mysql/data/ ended

解决办法

 

kill掉部分进程

 
//查看进程
 
# ps -ef
//把ps的查询结果通过管道给grep查找包含特定字符串的进程。管道符“|”用来隔开两个命令,管道符左边命令的输出会作为管道符右边命令的输入
 
 
# ps -ef | grep firefox smx 1827 1 4 11:38 ? 00:27:33 /usr/lib/firefox-3.6.18/firefox-bin smx 12029 1824 0 21:54 pts/0 00:00:00 grep --color=auto firefox
 
//杀了火狐的进程 # kill -s 9 1827
 

我的解决办法:

1.在/etc/中开启InnoDB

2.关闭nginx和php

/etc//nginx stop

/etc//php-fpm stop

3.重启mysql

/etc//mysqld restart

/etc//nginx start

/etc//php-fpm start