如何在Windows上安装mysql2 gem [英] How to install mysql2 gem on Windows

查看:128
本文介绍了如何在Windows上安装mysql2 gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用DevKit和XAMPP,现在我必须执行以下命令:

  gem install mysql2 -v 0.2.6 --platform = ruby​​  -  --with-mysql-dir =x:\Prog 
ram Files \mysql-5.5.11-winx64--with-mysql-lib =x :\ Program Files \mysql-5.5.11-winx64\lib--with-my
sql-include =x:\ Program Files \mysql-5.5.11-winx64\include --without-opt-dir

但是,XAMPP不包含 lib 在其MySQL目录下包含文件夹。我应该指定什么?



谢谢

解决方案

我曾经使用XAMPP的MySQL安装来获得运行在Windows 7上的MySQL2 gem。



在Ruby命令提示符下运行(确保将路径更新为已安装XAMPP / MySQL):

  gem install mysql2  -  --with-mysql-dir =C:\ xampp\mysql\bin

此命令的输出包括:



=========================



您已经安装了mysql2的二进制版本。
它是使用MySQL Connector / C版本6.0.2构建的。
建议使用完全相同的版本以避免潜在的问题。



在构建这个gem时,必要的DLL文件在
在下面的下载中:


http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32 .zip / from / pick

并将lib \ libmysql.dll文件放入您的Ruby bin目录中,例如C:\Ruby\bin



=========================



这非常重要。按照说明操作。下载该文件,从zip文件中的lib目录中提取libmysql.dll。
将所述dll复制到您的Ruby安装的bin文件夹中。如果您使用RailsInstaller并选择了默认值,那么该目录将类似于C:\RailsInstaller\Ruby1.9.3\bin。


I'm using DevKit and XAMPP, and now I have to execute the following command:

gem install mysql2 -v 0.2.6 --platform=ruby -- --with-mysql-dir="x:\Prog
ram Files\mysql-5.5.11-winx64" --with-mysql-lib="x:\Program Files\mysql-5.5.11-winx64\lib" --with-my
sql-include="x:\Program Files\mysql-5.5.11-winx64\include" --without-opt-dir

However, XAMPP does not include a lib or include folder on its MySQL directory. What should I specify instead ?

Thanks

解决方案

Here's the solution I used to get Ruby with the MySQL2 gem running on Windows 7 using XAMPP's MySQL installation.

At the Ruby command prompt run (make sure to update the path to wherever you've got XAMPP/MySQL installed):

gem install mysql2 -- --with-mysql-dir="C:\xampp\mysql\bin"

The output from this command includes:

=========================

You've installed the binary version of mysql2. It was built using MySQL Connector/C version 6.0.2. It's recommended to use the exact same version to avoid potential issues.

At the time of building this gem, the necessary DLL files where available in the following download:

http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick

And put lib\libmysql.dll file in your Ruby bin directory, for example C:\Ruby\bin

=========================

That is very important. Follow the instructions. Download the file, extract the libmysql.dll from the lib directory within the zip file. Copy said dll into the bin folder for your Ruby install. If you used RailsInstaller and selected the defaults, the directory will be something like C:\RailsInstaller\Ruby1.9.3\bin.

这篇关于如何在Windows上安装mysql2 gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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