MySQL常见内存不足启动失败的完美解决方法

数据库 发布日期:2024/9/22 浏览次数:1

正在浏览:MySQL常见内存不足启动失败的完美解决方法

1.启动MySQL时一直不成功,查看错误日志 /var/log/mysql/error.log

MySQL常见内存不足启动失败的完美解决方法 

2.主要的错误信息有如下几条:

[ERROR] InnoDB: mmap(136151040 bytes) failed; errno 12
[ERROR] InnoDB: Cannot allocate memory for the buffer pool
[ERROR] InnoDB: Plugin initialization aborted with error Generic error
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Failed to initialize plugins.
[ERROR] Aborting

3.查询后是因为内存不足,查看内存

MySQL常见内存不足启动失败的完美解决方法 

增加swap交换空间解决问题:

dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile

MySQL常见内存不足启动失败的完美解决方法 

4.增加自动挂载:

在文件/etc/fstab中加入 /swapfile swap swap defaults 0 0

service mysql start 启动成功

5. 备注:

生成空文件

dd if=/dev/zero of=1.txt bs=1M count=2 生成一个指定大小的空文件
if=文件名:输入文件名
of=文件名:输出文件名
bs=字节大小
count=个数

总结

以上所述是小编给大家介绍的MySQL常见内存不足启动失败的完美解决方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!

Windows上运行安卓你用过了吗
在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。