Mac OS X Lion - mysql:找不到命令

时间:2022-03-09 16:44:55

I have installed MySQL from this source, installation was successfully finished. But when I run in terminal which mysql, the output is empty. When mysql, the output is

我从这个源安装了MySQL,安装成功完成。但是当我在终端中运行mysql时,输出为空。当mysql时,输出是

-bash: mysql: command not found

-bash:mysql:找不到命令

Also, I updated bundle and ran the app - the result:

另外,我更新了bundle并运行了应用程序 - 结果:

/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require': Incorrect MySQL client library version! This gem was compiled for 5.5.28 but the client library is 5.6.12. (RuntimeError)

Can I ask you for help how to tackle this issue?

我可以请你帮忙解决这个问题吗?

Thank you in advance

先感谢您

EDIT: I also tried to install the gem to the mysql directory, like

编辑:我也尝试将gem安装到mysql目录,如

gem install mysql2 -- --with-mysql-config=/usr/local/Cellar/mysql/5.5.28/bin/mysql_config

But unfortunately the same - successfully installed, but when I run the app, still the same error

但不幸的是同样 - 成功安装,但当我运行应用程序时,仍然是同样的错误

1 个解决方案

#1


0  

In the past I've had problems installing the mysql2 gem, so I wrote a little shell script to make my life easier:

过去我在安装mysql2 gem时遇到了问题,所以我写了一个小shell脚本让我的生活更轻松:

#!/bin/sh -x

env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

Try updating that with the path to your mysql_config:

尝试使用mysql_config的路径更新它:

/usr/local/Cellar/mysql/5.5.28/bin/mysql_config

and change mysql to mysql2.

并将mysql更改为mysql2。

#1


0  

In the past I've had problems installing the mysql2 gem, so I wrote a little shell script to make my life easier:

过去我在安装mysql2 gem时遇到了问题,所以我写了一个小shell脚本让我的生活更轻松:

#!/bin/sh -x

env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

Try updating that with the path to your mysql_config:

尝试使用mysql_config的路径更新它:

/usr/local/Cellar/mysql/5.5.28/bin/mysql_config

and change mysql to mysql2.

并将mysql更改为mysql2。