Thursday, September 8, 2016

InnoDB: Unable to lock ./ib_logfile0, error: 11

One of our MySQL servers got restarted and after restart MySQL instance was not coming online.

I see below error message in mysqld.log

InnoDB: Unable to lock ./ib_logfile0, 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 ./ib_logfile0
160712 19:16:34 [ERROR] Plugin 'InnoDB' init function returned error.
160712 19:16:34 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160712 19:16:34 [ERROR] Unknown/unsupported storage engine: InnoDB
160712 19:16:34 [ERROR] Aborting
160712 19:16:34 [Note] /u01/mysql/5.5.22/bin/mysqld: Shutdown complete

I receive below error message when trying to access the database from command line

# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/u01/mysql/5.5.22/mysqld.sock' (2) 

It looks like the sudden server crash didn’t update the logfile or datafile header properly and not able to lock to bring the instance up.

After research I was able to fix this error by following below steps

1. Go to the data directory and backup the ./ib_logfile0 and copy a new one
$ mv ib_logfile0 ib_logfile0.bak
$ cp -a ib_logfile0.bak ib_logfile0

2. Restart the mySQL database

Thanks,
Satishbabu Gunukula, Oracle ACE
http://www.oracleracexpert.com

2 comments:

  1. Thanks for sharing useful information for us.I really enjoyed reading your blog, you have lots of great content.
    Packers And Movers Hyderabad
    In loading and unloading is done carefully by experienced workers. In addition, hyderabad packers and movers unpacks the delivery at the target, very efficiently & with maximum care.

    Packers And Movers gachibowli
    Packers And Movers kondapur
    Packers And Movers Hitech City

    ReplyDelete
  2. Lovely Website, Maintain the fantastic work. Thank you so much!
    Local Packers and Movers Ahmedabad list, Cheap Packers Movers Ahmedabad Charges, Affordable, Best Household Shifting Ahmedabad @ Packers and Movers Ahmedabad

    ReplyDelete