为特定的 mysql 客户端版本安装 mysql2 gem? [英] Install the mysql2 gem for a specific mysql client version?

查看:51
本文介绍了为特定的 mysql 客户端版本安装 mysql2 gem?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 mysql2 gem 与 rails 3.1.0.rc6 一起使用,但我'我的 mysql 客户端有问题.

I'm trying to use the mysql2 gem with rails 3.1.0.rc6, but I'm having some problem with my mysql client.

我在尝试启动服务器时收到此消息.

I'm getting this message when trying to start my server.

错误的 MySQL 客户端库版本!这个 gem 是为 5.1.53 编译的,但客户端库是 5.5.14.(运行时错误)

Incorrect MySQL client library version! This gem was compiled for 5.1.53 but the client library is 5.5.14. (RuntimeError)

如何编译/安装 mysql2 以便可以使用 mysql 5.5.14?

How do I compile/install mysql2 so that is can use mysql 5.5.14?

我尝试使用 gem pristine mysql2 没有成功.

I've tried using gem pristine mysql2 without success.

推荐答案

这里的问题是 MySQL2 gem 是为 Apple(开发包)安装的 MySQL 版本编译的,而不是我使用 Homebrew 编译的.

The problem here was that the MySQL2 gem was compiled for the MySQL version installed by Apple (Development package) not by me using Homebrew.

在安装 gem 时使用此命令解决了问题.

Using this command when installing the gem solved the problem.

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

不要忘记使用以下方法安装 mysql:

Don't forget to install mysql using:

sudo brew install mysql

现在的问题是我们需要以某种方式将选项传递给 bundler,为此您可以使用 捆绑程序配置.

The problem now is that we somehow need to pass the option to bundler, to do that you can use bundler config.

bundle config build.mysql2 --with-mysql-config=/usr/local/Cellar/mysql/5.5.14/bin/mysql_config

在您的 ruby​​ 应用程序中运行 bundle install 现在应该可以工作了.

Running bundle install in your ruby app should now work.

这篇关于为特定的 mysql 客户端版本安装 mysql2 gem?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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