mysql报错:cannot allocate memory for the buffer pool

数据库报错:

181217 12:00:00 [Note] Plugin 'FEDERATED' is disabled.

181217 12:00:00 InnoDB: The InnoDB memory heap is disabled

181217 12:00:00 InnoDB: Mutexes and rw_locks use GCC atomic builtins

181217 12:00:00 InnoDB: Compressed tables use zlib 1.2.3

181217 12:00:00 InnoDB: Using Linux native AIO

181217 12:00:00 InnoDB: Initializing buffer pool, size = 128.0M

InnoDB: mmap(137363456 bytes) failed; errno 12

181217 12:00:00 InnoDB: Completed initialization of buffer pool

181217 12:00:00 InnoDB: Fatal error: cannot allocate memory for the buffer pool

181217 12:00:00 [ERROR] Plugin 'InnoDB' init function returned error.

181217 12:00:00 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

181217 12:00:00 [ERROR] Unknown/unsupported storage engine: InnoDB

181217 12:00:00 [ERROR] Aborting


查看内存:

$ free

             total       used       free     shared    buffers     cached

Mem:       1019984     954132      65852        232      12252      79460

-/+ buffers/cache:     862420     157564

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:       1019984     954528      65456        232      10892      81356

-/+ buffers/cache:     862280     157704

Swap:      1048572          0    1048572
service mysqld start

重启解决,启动正常

Barley博客
  • 最新评论
  • 总共0条评论