mysql启动报InnoDB: mmap(137363456 bytes) failed; errno 12这类的错误

详细报错如下

InnoDB: mmap(137363456 bytes) failed; errno 12
2019-03-13 09:06:25 79498 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2019-03-13 09:06:25 79498 [ERROR] Plugin 'InnoDB' init function returned error.
2019-03-13 09:06:25 79498 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-03-13 09:06:25 79498 [ERROR] Unknown/unsupported storage engine: InnoDB
2019-03-13 09:06:25 79498 [ERROR] Aborting

网上也收集了很多文章都不能解决这个问题,一直看到这篇文章刚好解决了这个问题,收藏一下‘

https://www.cnblogs.com/olinux/p/5144205.html

解决方法如下:

查看内存

$ free
             total       used       free     shared    buffers     cached
Mem:        608476     565044      43432          0       1284      53996
-/+ buffers/cache:     509764      98712
Swap:            0          0          0

明显的swap问题。适当增加swap

$ sudo dd if=/dev/zero of=/swapfile bs=1M count=1024 #增加1G的SWAP进去
$ sudo mkswap /swapfile
$ sudo swapon /swapfile
$ free
             total       used       free     shared    buffers     cached
Mem:        608476     601432       7044          0        824      88752
-/+ buffers/cache:     511856      96620
Swap:      1048572          0    1048572

然后启动完美解决

 

你可能感兴趣的:(BUG记录)