Amazon EC2, MySQL Aborts Startup Due to Insufficient Memory (errno 12)
When running MySQL on an Amazon EC2 micro instance, you may encounter the error "InnoDB: mmap (x bytes) failed; errno 12." This error indicates that InnoDB, the storage engine used by MySQL, is unable to allocate the necessary memory for the buffer pool due to insufficient system memory.
To resolve this issue, you can follow these steps:
Add Swap Space: Micro instances do not have dedicated swap space by default, which can be overcome by creating a swap file. Run the following commands:
Example Configuration
The following is an example my.cnf configuration with increased buffer pool size and swap space:
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock symbolic-links=0 innodb_buffer_pool_size=1G [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
Note: The specific value for innodb_buffer_pool_size should be adjusted based on your application's memory requirements. It should not exceed the available system memory.
The above is the detailed content of Why Does My MySQL on Amazon EC2 Micro Instance Abort Startup with Error 12 (Insufficient Memory)?. For more information, please follow other related articles on the PHP Chinese website!