最近Mysql时常无缘无故的挂掉,查询日志后发现存在以下error。
2016-02-22 11:11:02 3668 [Note] InnoDB: Initializing buffer pool, size = 256.0M
InnoDB: mmap(274726912 bytes) failed; errno 12
2016-02-22 11:11:02 3668 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2016-02-22 11:11:02 3668 [ERROR] Plugin 'InnoDB' init function returned error.
2016-02-22 11:11:02 3668 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-02-22 11:11:02 3668 [ERROR] Unknown/unsupported storage engine: INNODB
2016-02-22 11:11:02 3668 [ERROR] Aborting
- 解决办法:
查看机器内存大小"free -m"
查看配置文件my.cnf中"innodb_buffer_pool_size"、"key_buffer"的大小设置
innodb_buffer_pool_size分配了256M,key_buffer分配了50M;调整innodb_buffer_pool_size为128M后,mysql重启正常。
原文链接:解决Mysql: [ERROR] InnoDB: Cannot allocate memory for the buffer pool,转载请注明来源!