Saturday, August 28, 2010

Mysql Unable to lock ibdata1 error 11 fix

 A bad shutdown can cause such erros on 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.
InnoDB: Error in opening ./ibdata1

For solution

backup original ibdata1.*

then ;
#mv ibdata1 ibdata1.bak
#cp -a ibdata1.bak ibdata1
restart mysql


  1. I confirm that this fix works !

    # MySQL - Restart
    # ------------------------------------------------------------------------------
    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

  2. Thanks for the tip. It worked like a charm! :-)

  3. This worked for me too. Was sceptical as I'd just changed from MySQL to Percona, but yep, worked...

  4. This seemed to work, but why? I don't think the permissions even changed. How could the problem have been caused?

  5. The most common cause of this problem is trying to start MySQL when it is already running. u use ubuntu?