Mac OS X Lion - mysql:找不到命令 [英] Mac OS X Lion - mysql: command not found

查看:100
本文介绍了Mac OS X Lion - mysql:找不到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

<块引用>

-bash: mysql: 找不到命令

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

/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require': 错误的 MySQL 客户端库版本!这个 gem 是为 5.5.28 编译的,但客户端库是 5.6.12.(运行时错误)

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

提前致谢

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

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

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

解决方案

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

<前>#!/bin/sh -xenv ARCHFLAGS="-arch x86_64" gem install mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config

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

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

并将mysql改为mysql2.

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

-bash: mysql: command not found

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

/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 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

解决方案

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

#!/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:

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

and change mysql to mysql2.

这篇关于Mac OS X Lion - mysql:找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆