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...
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With