最终在Windows 64位上安装了MySQL for Rails,现在 [英] Finally installed MySQL for Rails in Windows 64 bit, and now
问题描述
环境:
Windows 7 64bit (Home Premium)
Ruby 1.9.2 p290 (2011-07-09) [i386-mingw32]
Rails 3.0.10
MySQL 5.5
Ruby,尽管我已经成功安装了 mysql2
rubygem认为我在调用需要它的rails命令时缺少了gem
Ruby, despite my having successfully installed the mysql2
rubygem thinks that the gem is missing when I invoke a rails command that requires it.
度过了一个晚上,将mysql rubygem安装在Windows 64位上之后,我决定(最终)破解将mysql链接到本地Rails服务器的问题。这就是我试图做到的方式...
After having spent the evening getting the mysql rubygem installed on Windows 64 bit, I decided to (finally) get cracking on linking mysql to a local rails server. This is how I was trying to do it...
(公平)来自 cmd.exe
C:\rails\cookbook>gem install mysql --platform=ruby -- --with-mysql-include=c:\mysql\include --with-mysql-lib=c:\mysql\lib
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...
Installing RDoc documentation for mysql-2.8.1...
(I thought this was successful mysql install, should I test it somehow?)
C:\>gem install mysql2 --platform=ruby -- --with-mysql-include=c:\mysql\include --with-mysql-lib=c:\mysql\lib
Fetching: mysql2-0.3.7.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.7
1 gem installed
Installing ri documentation for mysql2-0.3.7...
Enclosing class/module 'mMysql2' for class Client not known
Installing RDoc documentation for mysql2-0.3.7...
Enclosing class/module 'mMysql2' for class Client not known
(Same as above - I thought this was successful mysql install)
C:\rails>rails new cookbook -d mysql
(successfully creates directories for project in c:\rails\cookbook)
C:\rails\cookbook>rails server
?[31mCould not find gem 'mysql2 (~> 0.2.11)' in any of the gem sources listed in your Gemfile.?[0m
?[33mRun `bundle install` to install missing gems.?[0m
注意:
我注意到它想要rubygem mysql2-0.2.11
,我有 0.3.7
。我尝试通过专门用于安装上述两个gem的方法安装 0.2.11
。没有骰子,在任何存储库中找不到名称为 mysql2-0.2.11
的宝石
Notes:
I noticed it wants rubygem mysql2-0.2.11
, I have 0.3.7
. I tried installing 0.2.11
specifically by the method I used to install the two gems above. No dice, it couldn't find a gem by the name mysql2-0.2.11
in 'any repository'
我很困惑,有什么想法吗?
I'm stumped, any thoughts fellas (and gals)?
推荐答案
我相信您的MySQL安装是64位的(例如Windows) ),对吗?
I believe your MySQL installation is a 64bits (like Windows), correct?
Ruby是32位的,因此您无法将32位链接到64位。
Ruby is 32bits, so you cannot link 32bits against 64bits.
我在博客上发布了一篇介绍安装步骤的文章:
I've posted a article covering the installation steps on my blog:
http://blog.mmediasys.com/2011/07/07/installing- mysql-on-windows-7-x64-and-ruby-ruby-with-it /
这些步骤使用MySQL Connector / C解决32位而不是64位问题。
These steps use MySQL Connector/C to workaround the 32bits versus 64bits issues.
mysql
或 mysql2
gem应该可以使用。
Both mysql
or mysql2
gem should work with this.
这篇关于最终在Windows 64位上安装了MySQL for Rails,现在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!