使用Homebrew在Mavericks上安装MySQL时出现问题

时间:2022-09-18 23:45:27

I'm having trouble getting MySQL to install on Mavericks using Homebrew. I'm not a command-line ninja by any stretch, and since there seems to be no definitive set of instructions for installing MySQL on OS X, I sort of cobbled together instructions from these two spots:

我无法使用Homebrew将MySQL安装到Mavericks上。我不是任何一个命令行忍者,因为似乎没有在OS X上安装MySQL的明确指令集,所以我从这两个地方拼凑了指令:

http://madebyhoundstooth.com/blog/install-mysql-on-mountain-lion-with-homebrew/

http://madebyhoundstooth.com/blog/install-mysql-on-mountain-lion-with-homebrew/

http://benjsicam.me/blog/how-to-install-mysql-on-mac-os-x-using-homebrew-tutorial/

http://benjsicam.me/blog/how-to-install-mysql-on-mac-os-x-using-homebrew-tutorial/

FWIW, I was able to get MySQL installed successfully on Mountain Lion using those two websites.

FWIW,我能够使用这两个网站在Mountain Lion上成功安装MySQL。

I'll detail my install steps below, and then bottom out at the error I'm getting. Hopefully, somebody with more command-line knowledge than what I possess will be able to spot my error(s).

我将在下面详细说明我的安装步骤,然后在我得到的错误中找到最低点。希望有一个比我拥有更多命令行知识的人能够发现我的错误。

First, at the suggestion of a website I read, I uninstalled MySQL, in case a previous version happened to be there. I did so like this (by the way, this all pre-supposes that I've installed Homebrew successfully):

首先,根据我读过的网站的建议,我卸载了MySQL,以防前一版本碰巧在那里。我是这样做的(顺便说一下,这一切都预先假设我已经成功安装了Homebrew):

brew remove mysql
cd /
brew cleanup
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /usr/local/var/mysql

When I ran the fourth line, I got this result:

当我运行第四行时,我得到了这个结果:

launchctl: Couldn't stat("[my-home-directory]/Library/LaunchAgents/homebrew.mxcl.mysql.plist"): No such file or directory

Not sure if that mattered or not; perhaps the uninstall process already took care of that, or perhaps that file was never there in the first place. Either way, it didn't seem like a big problem, and everything appeared to uninstall properly.

不确定这是否重要;也许卸载过程已经解决了这个问题,或者也许该文件从未出现在那里。无论哪种方式,它似乎不是一个大问题,一切似乎正确卸载。

So then I installed, like this:

所以我安装了,像这样:

brew install mysql
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
mysql.server start

For what it's worth, I got the message "Already loaded" after running the third line above. When I ran mysql.server start, I got . SUCCESS! So that seems good, right?

为了它的价值,我在运行上面的第三行后收到了“已经加载”的消息。当我运行mysql.server启动时,我得到了。成功!这看起来不错,对吧?

Then I ran these two lines:

然后我运行了这两行:

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

...and at this point, I got a steady stream of this in the terminal:

......在这一点上,我在终端中得到了稳定的信息:

[ERROR] InnoDB: Unable to lock ./ibdata1, error: 35

I found this post, but it refers to a MAMP installation, which this is not, and when I searched my Mac for the two .pid files it references, I came up empty.

我找到了这篇文章,但它指的是一个MAMP安装,这不是,当我在我的Mac上搜索它引用的两个.pid文件时,我出现了空白。

http://aralbalkan.com/1931/

http://aralbalkan.com/1931/

So I'm kind of stumped. In another installation attempt from earlier, I was attempting to configure the default_socket in php.ini, based on the first URL I listed above, and I could find mysql.sock neither in the /tmp directory, nor did I find a MySQL directory in /var, so I have no idea what's going on.

所以我有点难过。在前面的另一个安装尝试中,我试图在php.ini中配置default_socket,基于我上面列出的第一个URL,我可以在/ tmp目录中找到mysql.sock,也没有找到MySQL目录/ var,所以我不知道发生了什么。

Any help or guidance is greatly appreciated.

非常感谢任何帮助或指导。

Thanks!

谢谢!

1 个解决方案

#1


0  

The following URL works for me:

以下网址适用于我:

http://blog.joefallon.net/2013/10/install-mysql-on-mac-osx-using-homebrew/

http://blog.joefallon.net/2013/10/install-mysql-on-mac-osx-using-homebrew/

As you can see, the instruction is quite straightforward, and I just clean-installed Mavericks, so there is no pre-installed MySQL. I think that you got into the troubles probably because you homebrew remove before launchctl unload, so unloading and clean up might not be clearly done.

正如您所看到的,该指令非常简单,我只是清理安装了Mavericks,因此没有预先安装的MySQL。我认为你陷入麻烦可能是因为你在启动卸载之前自行删除了,所以卸载和清理可能不是很清楚。

FYI, the following is the version numbers for my homebrew and the installed MySQL.

仅供参考,以下是我的自制软件和已安装的MySQL的版本号。

sh-3.2$ brew --version
0.9.5
sh-3.2$ mysql --version
mysql  Ver 14.14 Distrib 5.6.15, for osx10.9 (x86_64) using  EditLine wrapper
sh-3.2$ 

#1


0  

The following URL works for me:

以下网址适用于我:

http://blog.joefallon.net/2013/10/install-mysql-on-mac-osx-using-homebrew/

http://blog.joefallon.net/2013/10/install-mysql-on-mac-osx-using-homebrew/

As you can see, the instruction is quite straightforward, and I just clean-installed Mavericks, so there is no pre-installed MySQL. I think that you got into the troubles probably because you homebrew remove before launchctl unload, so unloading and clean up might not be clearly done.

正如您所看到的,该指令非常简单,我只是清理安装了Mavericks,因此没有预先安装的MySQL。我认为你陷入麻烦可能是因为你在启动卸载之前自行删除了,所以卸载和清理可能不是很清楚。

FYI, the following is the version numbers for my homebrew and the installed MySQL.

仅供参考,以下是我的自制软件和已安装的MySQL的版本号。

sh-3.2$ brew --version
0.9.5
sh-3.2$ mysql --version
mysql  Ver 14.14 Distrib 5.6.15, for osx10.9 (x86_64) using  EditLine wrapper
sh-3.2$