Linux set virtual memory (swap) to troubleshoot MySQL hangs due to insufficient memory

Source: Internet
Author: User

The MySQL error log shows:


Innodb:mmap (137363456 bytes) failed; errno 12
2016-03-01 01:38:42 13064 [ERROR] Innodb:cannot allocate memory for the buffer pool
2016-03-01 01:38:42 13064 [ERROR] Plugin ' InnoDB ' init function returned ERROR.
2016-03-01 01:38:42 13064 [ERROR] Plugin ' InnoDB ' registration as a STORAGE ENGINE failed.
2016-03-01 01:38:42 13064 [ERROR] unknown/unsupported storage Engine:innodb
2016-03-01 01:38:42 13064 [ERROR] Aborting

This is usually caused by low system memory, the solution is to upgrade the system memory or add swap;

Workaround:
1) Add the following sentence to the/ETC/MYSQL/MY.CNF mysqld:

innodb_buffer_pool_size = 64M

Also set the swap partition, because my VPS is no swap partition, through fdisk -l and 1mount do not see the swap information, need to manually add.

2) steps to add a swap partition:

2.1) dd if=/dev/zero of=/swapfile bs=1M count=10242.2) mkswap /swapfile2.3) swapon /swapfile2.4) 添加这行: /swapfile swap swap defaults 0 0 到 /etc/fstab

Now that you have set up the swap partition and restarted MySQL, look for a follow-up check to see if it will happen.

Linux set virtual memory (swap) to troubleshoot MySQL hangs due to insufficient memory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.