Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Background: I've just updated OS X to Mavericks, then I removed brew(and everything I installed via homebrew) using:rm -rf /usr/local and began to reinstall everything.

After brew install mysql, I tried:

unset TMPDIR
$ mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

But I got:

mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
Installing MySQL system tables...2014-02-12 16:43:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-02-12 16:43:45 2358 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-02-12 16:43:45 2358 [Note] InnoDB: The InnoDB memory heap is disabled
2014-02-12 16:43:45 2358 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-02-12 16:43:45 2358 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-02-12 16:43:45 2358 [Note] InnoDB: Using CPU crc32 instructions
2014-02-12 16:43:45 2358 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-02-12 16:43:45 2358 [Note] InnoDB: Completed initialization of buffer pool
2014-02-12 16:43:45 2358 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2014-02-12 16:43:45 2358 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2014-02-12 16:43:45 2358 [Note] InnoDB: Retrying to lock the first data file
2014-02-12 16:43:46 2358 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35
2014-02-12 16:43:46 2358 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.

And I got totally lost, and started googling, I only fond this, which seems to be helpful: http://blog.tiagocarvalho.pt/2014/01/mac-os-x-mysql-problems.html

After read that post, still did not get a clear picture, but what in my mind was to (according to that post): FIRST: kill -9 (the mysql PID) and THEN (I think) I should be able to try mysql_install_db again.

So I tried, the ps xua | grep mysql showed:

4683   0.0  0.0  2442000    624 s001  S+    7:39下午   0:00.01 grep mysql
4547   0.0  3.3  3080024  68276   ??  S     7:18下午   0:00.98 /usr/local/Cellar/mysql/5.6.16/bin/mysqld --basedir=/usr/local/Cellar/mysql/5.6.16 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql/5.6.16/lib/plugin --log-error=/usr/local/var/mysql/UU.local.err --pid-file=/usr/local/var/mysql/UU.local.pid
4476   0.0  0.0  2436436    808   ??  S     7:18下午   0:00.02 /bin/sh /usr/local/bin/mysqld_safe

BUT, after kill -9 4547 and kill -9 4476, they showed up again with two different PID...

I don't know what is going on... Any hint?

ALSO, if I do mysql.server stop, then mysql.server status I'll find it restarts...

like image 696
iceX Avatar asked Feb 12 '14 11:02

iceX


1 Answers

Oops... I think I've found it...

I just need to launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist.

I mean, I did not unload it before rm -rf /usr/local, so after I reinstall brew and mysql, it will automatically starts, which prevents me from doing mysql_install_db...

btw, I found this link very helpful as well: How do you stop MySQL on a Mac OS install?

like image 142
iceX Avatar answered Oct 08 '22 21:10

iceX