Amazon EC2, mysql aborting start because InnoDB: mmap (x bytes) failed; errno 12

2017年09月06日 liunx, mysql 暂无评论 阅读 61 次

Amazon EC2, mysql aborting start because InnoDB: mmap (x bytes) failed; errno 12

137down voteaccepted

I met the same problem when I tried to run a wordpress on my micro instance without RDS.

Adding a Swap page solved the problem for me.

You can follow this to setup the swap page:


If it still doesn't work for you, consider using the RDS service.


The link to the blog sometimes fails. I copied the content below for the record. Credit goes to the blog author Pedram Moubed:

Amazon EC2 Micro Instance Swap Space - Linux

I have a Amazon EC2 Linux Micro instance. Since Micro instances have only 613MB of memory, MySQL crashed every now and then. After a long search about MySQL, Micro Instance and Memory Managment I found out there is no default SWAP space for Micro instance. So if you want to avoid the crash you may need to setup a swap space for your micro instance. Actually performance wise is better to enable swap.

Steps below show how to make a swap space for your Micro instance. I assume you have AWS Account with a Micro instance running.

  1. Run dd if=/dev/zero of=/swapfile bs=1M count=1024
  2. Run mkswap /swapfile
  3. Run swapon /swapfile
  4. Add this line /swapfile swap swap defaults 0 0 to /etc/fstab

Step 4 is needed if you would like to automatically enable swap file after each reboot.

Some useful command related to SWAP space:

$ swapon -s   
$ free -k

$ swapoff -a
$ swapon  -a


  1. http://www.thegeekstuff.com/2010/08/how-to-add-swap-space/
  2. http://cloudstory.in/2012/02/getting-the-best-out-of-amazon-ec2-micro-instances/
  3. http://cloudstory.in/2012/02/adding-swap-space-to-amazon-ec2-linux-micro-instance-to-increase-the-performance/
  4. http://aws.amazon.com/ec2/instance-types/




Copyright © web前端技术开发个人博客 保留所有权利.   Theme  Ality