Skip to content
Rezha Julio
Go back

MariaDB error failed to start, errno 12

2 min read

This server hosts about 4 blogs that all run with MariaDB 10. After a few days running, the MariaDB service keeps failing on this micro EC2 instance with error like this.

Terminal window
120423 09:13:38 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
120423 09:14:27 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120423 9:14:27 [Note] Plugin 'FEDERATED' is disabled.
120423 9:14:27 InnoDB: The InnoDB memory heap is disabled
120423 9:14:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120423 9:14:27 InnoDB: Compressed tables use zlib 1.2.3
120423 9:14:27 InnoDB: Using Linux native AIO
120423 9:14:27 InnoDB: Initializing buffer pool, size = 512.0M
InnoDB: mmap(549453824 bytes) failed; errno 12
120423 9:14:27 InnoDB: Completed initialization of buffer pool
120423 9:14:27 InnoDB: Fatal error: cannot allocate memory for the buffer pool
120423 9:14:27 [ERROR] Plugin 'InnoDB' init function returned error.
120423 9:14:27 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120423 9:14:27 [ERROR] Unknown/unsupported storage engine: InnoDB
120423 9:14:27 [ERROR] Aborting

Error 12 is OS error code:(ENOMEM) Out of memory, so of course you could just throw more memory at it. Or you could just enable swap so MariaDB doesn’t crash anymore. By default, a micro EC2 instance doesn’t have swap, so we should run a few Linux commands to make one.

Terminal window
sudo dd if=/dev/zero of=/swaps bs=1M count=1024
sudo mkswap /swaps
sudo swapon /swaps

Taadaa!! Your MariaDB instance should run flawlessly now. To make your change persist across reboots, add this line /swaps swap swap defaults 0 0 to /etc/fstab.


Related Posts


Previous Post
Vagrant's hosted Django can't be accessed
Next Post
PostgreSQL 9.4 failed to start on Manjaro