I have an Amazon ec2 micro instance that holds a WordPress site. Since yesterday, my mysql db keep crashing saying:
[ec2-user@ip-xxx-xx-xx-xxx ~]$ sudo service mysqld status mysqld dead but subsys locked
I tried restarting the mysqld but after every 5 mins it keeps crashing with the same message - "Error establishing a database connection"
This is what my DB log file reads -
160123 05:44:41 mysqld_safe mysqld restarted 160123 5:44:43 [Note] /usr/libexec/mysql55/mysqld (mysqld 5.5.46) starting as process 7928 ... 160123 5:44:44 [Note] Plugin 'FEDERATED' is disabled. 160123 5:44:46 InnoDB: The InnoDB memory heap is disabled 160123 5:44:46 InnoDB: Mutexes and rw_locks use GCC atomic builtins 160123 5:44:46 InnoDB: Compressed tables use zlib 1.2.8 160123 5:44:46 InnoDB: Using Linux native AIO 160123 5:44:46 InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(137363456 bytes) failed; errno 12 160123 5:44:46 InnoDB: Completed initialization of buffer pool 160123 5:44:46 InnoDB: Fatal error: cannot allocate memory for the buffer pool 160123 5:44:46 [ERROR] Plugin 'InnoDB' init function returned error. 160123 5:44:46 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 160123 5:44:46 [ERROR] Unknown/unsupported storage engine: InnoDB 160123 5:44:46 [ERROR] Aborting 160123 5:44:46 [Note] /usr/libexec/mysql55/mysqld: Shutdown complete 160123 05:44:46 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
The common solution that found out there when I Googled for a solution for the issue -
mysqld dead but subsys locked, is to create a swapfile. I did exactly as most of the solution suggest but since I'm not well versed with UNIX, I don't know what I have done is right or not.
I have a swap space of 1MB.
[ec2-user@ip-xx-xx-xx-xxx /]$ free total used free shared buffers cached Mem: 1019452 613820 405632 76 19124 64348 -/+ buffers/cache: 530348 489104 Swap: 1048572 46604 1001968
Or, Is there any other solution for this issue. Kindly help.