简体   繁体   English

安装mysql作为gem

[英]installing mysql as a gem

i want to develop rails 3 apps using mysql on windows 7 (64 bit) and i have installed mysql via the msi download from the mysql site. 我想在Windows 7(64位)上使用mysql开发rails 3应用程序,我已经通过mysql站点的msi下载安装了mysql。

my question is that do i still need to install the mysql gem? 我的问题是,我还需要安装mysql gem吗?

thanks 谢谢

The mysql gem provides the ruby bindings, so yes, you need to install this. mysql gem提供了ruby绑定,所以是的,你需要安装它。

With Rails 3 you should use the mysql2 gem rather than the mysql gem. 使用Rails 3,您应该使用mysql2 gem而不是mysql gem。

Here is a proper solution for anyone interested, that doesn't mess up your current installation of mysql server 对于任何有兴趣的人来说,这是一个合适的解决方案,它不会搞砸你当前安装的mysql服务器

  1. Download a zip file with mysql server 5.1 NOT the msi one. 下载带有mysql服务器5.1的zip文件而不是msi。 Make sure it's 32-bit NOT 64-bit. 确保它是32位非64位。 ( From here ) 从这里
  2. Since there is no installer file with this, create a folder c:\\mysql-gem-install - you can remove it once you finish. 由于没有安装程序文件,请创建一个文件夹c:\\ mysql-gem-install - 完成后可以将其删除。
  3. Extract all the files from the zip file into the folder you just created. 将zip文件中的所有文件解压缩到刚刚创建的文件夹中。
  4. now run this command 现在运行此命令

    gem install mysql2 -- '--with-mysql-lib="c:\\mysql-gem-install\\lib\\opt" --with-mysql-include="c:\\mysql-gem-install\\include"' gem install mysql2 - ' - with-mysql-lib =“c:\\ mysql-gem-install \\ lib \\ opt”--with-mysql-include =“c:\\ mysql-gem-install \\ include”'

I just installed mysql2 gem v. 0.3.7 我刚刚安装了mysql2 gem v.0.3.7

Yes you do. 是的你是。 The mysql gem is a ruby driver (interface) to connect to the mysql database. mysql gem是一个连接到mysql数据库的ruby驱动程序(接口)。

You should use mysql2 gem instead with Rails3. 你应该使用mysql2 gem而不是Rails3。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM