24

I'm trying to start MySQL in safe mode but the log file just keeps spitting out:

[ERROR] InnoDB: Unable to lock ./ibdata1 error: 35
[Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.

Notes:

  1. I've stopped all mysql processes and have checked using the ps command

  2. I've read this having repeated trouble with MySQL and Snow Leopard - Unable to lock ./ibdata1, error: 35

Community
  • 1
  • 1
Snowcrash
  • 80,579
  • 89
  • 266
  • 376

3 Answers3

42

Just had this issue with MAMP Pro. Couldn't stop or start MySQL. Typed ps aux | grep mysql, then kill [process id] for each line. Then I could successfully launch MySQL again from MAMP Pro.

Nico Prat
  • 686
  • 2
  • 6
  • 13
  • 3
    This solved my issue but I did notice another mysql process that kept reappearing even though I did not start mysql. A new process id every second or so. Only ever one active at a time – BobB Feb 17 '18 at 17:23
  • @BobB that may have been the actual `grep mysql` command you were seeing the in processes list. – Larry Jul 23 '18 at 11:21
  • @Larry, both `grep mysql` and fresh `_mysql` processes are there. ex : `Keitel 1302 0.0 0.0 4267752 624 s000 R+ 8:13AM 0:00.00 grep mysql _mysql 1300 0.0 2.2 4665848 182144 ?? Ss 8:13AM 0:00.34 /usr/local/mysql/bin/mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid --keyring-file-data=/usr/local/mysql/keyring/keyring --early-plugin-load=keyring_file=keyring_file.so` – KeitelDOG Oct 05 '18 at 12:32
18

Strange error codes, both from MySQL and the operating system, can be explained by running a shell command perror which is a part of MySQL distribution. On Linux, for example, perror 35 returns OS error code 35: Resource deadlock avoided. I do not have an OSX system handy to test, but from this:

http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/sys/errno.h

I gather that error 35 is "Resource temporarily unavailable", meaning that some other process (possibly another instance of mysqld?) has already locked the file.

To debug, first I would check if there is another MySQL process running by chance (looks like you already have), and if not, reboot for good measure to make sure there are no strange stale file locks, and then try again.

Somebody has run into this error before, and found a solution:

mysql_install_db, error: 35, on a Mac OS X 10.9.1

Community
  • 1
  • 1
Sasha Pachev
  • 5,162
  • 3
  • 20
  • 20
0

I had a similar issue after updating MAMP from 4.x to 5.x

Unfortunately the only way that I could manage to resolve this was by manually removing all of my database files (moving them into another directory) then starting MySQL via MAMP; this seemed to work.

The files in question (for me) were in:

/Library/Application Support/appsolute/MAMP PRO/db/mysql57

All of the files in this directory (except the mysql directory) need moving somewhere else. I was then able to start MySQL.

I realise this isn't a very useful answer for most situations, but if this is a local development environment (like MAMP, as in my case) then I think losing the local databases is probably acceptable.

Sean
  • 6,389
  • 9
  • 45
  • 69