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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.