panzhuli
panzhuli

Reputation: 2940

having repeated trouble with MySQL and Snow Leopard - Unable to lock ./ibdata1, error: 35

I don't know very much about server maintenance and am trying to learn by managing my own Mac. I'm running a local rails application with a MySQL database (5.5.9). All has been well for a long time UNTIL I attempted to start a new rails project. At that time, I ran bundle install, which updated my mysql gem from 0.2.6 to 0.3.6. Ever since then, or I'm associating with that (it may be that I also installed RVM around that time), I can't startup my MySQL server. I get the following error:

Unable to lock ./ibdata1, error: 35

repeatedly. I've tried fixing with:

mv ibdata1 ibdata1.bak
cp -a ibdata1.bak ibdata1

which works (reference: http://cglreport.zhenhua.info/2008/08/mysql-error-unable-to-lock-ibdata1.html) (I have to do it on a few other files too), but it only works for a while. When I restart, or periodically the problem comes back. What's going on ? This doesn't seem to be a reasonable solution to me. Ideas? Thanks!

Upvotes: 10

Views: 10446

Answers (2)

pal4life
pal4life

Reputation: 3378

Here is what fixed it for me, looked all around and nothing helped.

To fix this issue, make a copy of the original files (ibdata1, ib_logfile0, ib_logfile1…).

mv /var/lib/mysql/ibdata1 /var/lib/mysql/ibdata1.bak

cp -a /var/lib/mysql/ibdata1.bak /var/lib/mysql/ibdata1

Now start mysql service.

/etc/init.d/mysql start

In my case it was the XAMPP files so I did

sudo mv /Applications/XAMPP/xamppfiles/var/mysql/ibdata1 /Users/username/Documents/tmp/ibdata1.bak
sudo cp -a /Users/username/Documents/tmp/ibdata1.bak /Applications/XAMPP/xamppfiles/var/mysql/ibdata1

Then I noticed that mysql was already started for me.

Based on the solution here

Upvotes: 0

user149341
user149341

Reputation:

That sounds pretty convincingly like you already have an instance of your MySQL server running, and you're trying to steal a data file that it's using.

Upvotes: 13

Related Questions