MySQL error even after recreating the droplet with previous working image?

June 20, 2014 1.4k views
I ran into a problem in mySQL
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
I have tried the method on the net to rename/copy ibdata1 files, but it didn't work. So I decided to re-create a droplet with the previous saved image (very long ago, so I am actually pissed but I am sure it was 100% working because the this mySQL error started to happen this morning by my manual restarting) But guess what? After recreating the droplet, mySQL still shows the same error! How could this happen? What am I supposed to do?
3 Answers
sudo mv /usr/local/mysql/data/ibdata1 /usr/local/mysql/data/ibdata1.bak
sudo mv /usr/local/mysql/data/ib_logfile0 /usr/local/mysql/data/ib_logfile0.bak
sudo mv /usr/local/mysql/data/ib_logfile1 /usr/local/mysql/data/ib_logfile1.bak
sudo cp -a /usr/local/mysql/data/ibdata1.bak /usr/local/mysql/data/ibdata1
sudo cp -a /usr/local/mysql/data/ib_logfile0.bak /usr/local/mysql/data/ib_logfile0
sudo cp -a /usr/local/mysql/data/ib_logfile1.bak /usr/local/mysql/data/ib_logfile1
sudo /etc/init.d/mysql restart
@digitalocean I tried this already. It's exactly what I Googled solution that most others say working. However for me, it's not working. Besides, after I recreated the droplet with previous image (when mySQL was working 100% for sure), it still shows the same error, which I really surprise about.
Try running this:
proper_owner=`ls -lah /usr/local/mysql/data/ibdata1|awk '{print $3}'|wc -l`
proper_mount=`mount |grep "vda"|grep "rw"|wc -l`
disk_used=`df -h|grep "vda"|awk '{print $5}'|sed 's/%//g'`
inode_used=`df -i|grep "vda"|awk '{print $5}'|sed 's/%//g'`
if [ "$proper_owner" = "0" ]; then echo "wrong owner. Needs to be 'mysql'"; else echo "Good owner. Moving on";fi; if [ "$proper_mount" = "0" ]; then echo "Mount isn't read/write.  That may be the issue."; else echo "mount is read/write. Moving on"; fi; if [ "$disk_used" -gt "90" ]; then echo "Your drive is $disk_used % full. This may be the problem"; else echo "Disk space isn't too bad off. Moving on"; fi; if [ "$inode_used" -gt "90" ]; then echo "Inode count is very high( $inode_used %). This may be the problem"; else echo "Inode count is most likely not the cause";fi
(I've tested it on my droplet, but can't promise all the variables are the same on yours) If this runs without issue, paste the results here.
  • There's an error in my code. change it to this: proper_owner=`ls -lah /usr/local/mysql/data/ibdata1|awk '{print $3}'|grep "mysql"|wc -l`
Have another answer? Share your knowledge.