终于在64位Windows中安装了MySQL for Rails,现在

终于在64位Windows中安装了MySQL for Rails,现在,mysql,ruby-on-rails,ruby,database,Mysql,Ruby On Rails,Ruby,Database,环境: Windows 7 64bit (Home Premium) Ruby 1.9.2 p290 (2011-07-09) [i386-mingw32] Rails 3.0.10 MySQL 5.5 Ruby,尽管我已经成功安装了mysql2rubygem,但当我调用需要它的rails命令时,rubygem认为它丢失了 在花了一个晚上的时间将mysql rubygem安装到Windows 64位之后,我决定(最终)开始破解将mysql链接到本地rails服务器的问题。这就是我想做的

环境:

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命令时,rubygem认为它丢失了

在花了一个晚上的时间将mysql rubygem安装到Windows 64位之后,我决定(最终)开始破解将mysql链接到本地rails服务器的问题。这就是我想做的

(相当)来自
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
。我尝试安装
0.2.11
,具体方法是安装上面两个gem。没有骰子,它无法在“任何存储库”中找到名为
mysql2-0.2.11
的宝石


我被难住了,有什么想法吗伙计们(和女孩们)?

你是否在你的
Gemfile
中包含了
mysql2
,然后执行了
bundle安装

我相信你的MySQL安装是64位的(像Windows一样),对吗

Ruby是32位的,因此您不能将32位链接到64位

我在博客上发布了一篇文章,介绍了安装步骤:

这些步骤使用MySQL Connector/C解决32位与64位的问题

mysql
mysql2
gem都应该可以使用它。

@@mysql安装(在64位体系结构上)

下载连接器(下载zip文件并将其解压缩到c驱动器)

下载mysql

用于安装带有连接器的mysql的命令
在此之后,从连接器文件夹复制libmysql.dll并将其粘贴到ruby>bin文件夹

Windows不是ruby web开发的最佳平台。我建议使用VirtualBox和Vagrant()创建一个Linux虚拟机,除非您有在Windows上运行的特殊需要。如果您的实际部署环境是Linux,那么在Linux虚拟机中开发当然是您最感兴趣的,这样您的产品和开发环境就尽可能接近了。我不认为你会在Linux操作系统中遇到这些问题,因为大多数开发人员都使用Linux操作系统,你可以获得更多的帮助。@Cixate或至少像sqlite3这样的东西,它与Windows+集成得更为成熟。很高兴听你这么说!不要忘记将问题标记为已解决,以便其他人找到它!
C:\Sites\rails_project\resume>gem install mysql --platform=ruby -- --with-mysql-
dir=C:/mysql-connector-c-6.1.0-win32