Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

MySQLD Dead But Subsys Locked - Troubleshooting MySQL Recurring Issue

RSS
Modified on Thu, May 26, 2016, 11:54 AM by Administrator Categorized as MySQL

Overview

On Amazon EC2 micro instances, it seems fairly common for MySQL to become unavailable on a recurring basis, with the following message returned by the service mysqld status command: mysql dead but subsys locked. This article explains how to address this issue.

Credits

The following article was adapted from the following pages.


Short Term Solution

Simply restarting the MySQL service via the following command seems to fix the issue, at least temporarily.

service mysqld restart

Long Term Solution

The first article in the Credits section above suggests that this may be a memory issue, which can be solved by creating a swap file for MySQL, as follows.

1. Shut down MySQL service

service mysqld stop

2. Create a swap file. (This will take a few moments)

dd if=/dev/zero of=/swapfile bs=1M count=1024

3. Implement the swap file

mkswap /swapfile
swapon /swapfile
chmod 0600 /swapfile

4. Configure MySQL to use the swap file by adding the following line to /etc/fstab

/swapfile swap swap defaults 0 0

5. Start MySQL service

service mysqld start

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2018, Patrick Jasinski.