最后在Windows 64位中安装了MySQL for 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命令时,我认为缺少gem。

在晚上获得在Windows 64位上安装mysql ruby​​gem之后,我决定(最终)开始将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 。 我尝试通过上面安装两个gem的方法专门安装0.2.11 。 没有骰子,它在’任何存储库’中找不到名为mysql2-0.2.11的gem

我很难过,任何想法(和女孩)?

我相信你的MySQL安装是64位(比如Windows),对吗?

Ruby是32位,所以你不能将32位与64位连接起来

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

http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/

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

mysqlmysql2 gem都应该可以使用它。

你有没有在你的Gemfile包含mysql2并随后执行了bundle install

@@我的sql安装(64位架构)

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

http://dev.mysql.com/downloads/connector/c/

下载mysql

http://dev.mysql.com/downloads/installer/5.6.html

命令用连接器安装mysql

 C:\Sites\rails_project\resume>gem install mysql --platform=ruby -- --with-mysql- dir=C:/mysql-connector-c-6.1.0-win32 

从连接器文件夹复制libmysql.dll并将其粘贴到ruby> bin文件夹之后