mysql_install_db,错误:35,在Mac OS X 10.9.1上

时间:2014-02-12 11:46:22

标签: mysql osx-mavericks

背景:我刚刚将OS X更新为Mavericks,然后我使用:rm -rf /usr/local删除了brew(以及我通过自制软件安装的所有内容)并开始重新安装所有内容。

brew install mysql之后,我尝试了:

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

但我得到了:

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.

我完全迷失了,开始谷歌搜索,我只喜欢这个,这看起来很有用:http://blog.tiagocarvalho.pt/2014/01/mac-os-x-mysql-problems.html

看了那篇文章之后,仍然没有得到清晰的图片,但我脑子里想的是(根据那篇文章): FIRST:kill -9(mysql PID)然后(我认为)我应该能够再次尝试mysql_install_db

所以我试过,ps xua | grep mysql显示:

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

但是,在kill -9 4547kill -9 4476之后,他们又出现了两个不同的PID ......

我不知道发生了什么......有什么提示吗?

另外,如果我mysql.server stop,那么mysql.server status我会发现重新启动...

2 个答案:

答案 0 :(得分:9)

哎呀...我想我已经找到了......

我只需要launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

我的意思是,我没有在rm -rf /usr/local之前卸载它,所以在我重新安装brew和mysql后,它会自动启动,这阻止我做mysql_install_db ...

不过,我发现此链接也非常有用:How do you stop MySQL on a Mac OS install?

答案 1 :(得分:0)

注意:我使用自制软件安装。 mysql文件的位置可能取决于您是使用brew还是包安装程序。

我首先尝试通过列出所有mysql进程来杀死进程 - ps aux | grep mysql。那不行。事实证明它仍然重新启动,奇怪!

所以我在这里列出了文件 - &gt; ls /usr/local/var/mysql。找到三个pid文件。摆脱它们 rm -rf <my-machine>.pid rm -rf <my-machine.local.pid> rm -rf mysqld_safe.pid

这帮助关闭了他们。

在您的情况下,这些文件可能位于/usr/local/mysql/var或其他位置。只是看看!

古德勒克!