MySQL記憶體不足啟動失敗的解決方案

來源:互聯網
上載者:User

MySQL記憶體不足啟動失敗的解決方案

1.啟動MySQL時一直不成功,查看錯誤記錄檔 /var/log/mysql/error.log

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.查詢後是因為記憶體不足,查看記憶體

  

增加swap交換空間解決問題:

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

  

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=個數

本文永久更新連結地址:https://www.bkjia.com/Linux/2018-03/151366.htm

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.