2

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.

enter image description here

Or, Is there any other solution for this issue. Kindly help.

Arun Antony
  • 573
  • 4
  • 13
  • 26

1 Answers1

2

Have you tried this mysql is dead but subsys locked

Seems quite straightforward. Also please consider moving to RDS instead of running a mysql server in ec2. Saves you from troubles of this kind.

Community
  • 1
  • 1
Sougata
  • 56
  • 10
  • Thanks Sougata. I applied the solution suggested in the link in your answer. I'll wait and see if this works. Btw, can you help me understand(or any link to read) if I can use RDS with my WordPress installation? – Arun Antony Jan 23 '16 at 18:13
  • Yes you can use rds with wordpress. I'm not very experienced in wordpress but from what i remember, you simply add the hostname,username and password in a configuration file. RDS is nothing but a managed mysql server. https://aws.amazon.com/rds/ . Its quite simple actually. – Sougata Jan 23 '16 at 18:16
  • Thank you Sougata for the info. – Arun Antony Jan 23 '16 at 18:18
  • Crashed again. Let me try RDS. – Arun Antony Jan 24 '16 at 04:09
  • Looks like its a pretty costly affair. Looking for another solution. – Arun Antony Jan 24 '16 at 04:53