首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >终于在Windows64位上安装了MySQL for Rails,现在

终于在Windows64位上安装了MySQL for Rails,现在
EN

Stack Overflow用户
提问于 2011-09-07 11:11:09
回答 3查看 3.9K关注 0票数 1

环境:

代码语言:javascript
复制
Windows 7 64bit (Home Premium)

Ruby 1.9.2 p290 (2011-07-09) [i386-mingw32]

Rails 3.0.10

MySQL 5.5

尽管我已经成功安装了mysql2 rubygem,但当我调用需要它的rails命令时,rubygem仍然认为gem丢失了。

在花了一个晚上在Windows64位上安装了mysql rubygem之后,我决定(终于)开始将mysql链接到本地rails服务器。这就是我想做的.

(确切地说)来自cmd.exe的精确文字记录

代码语言:javascript
复制
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。

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

EN

回答 3

Stack Overflow用户

发布于 2011-09-07 22:13:17

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

是32位的,所以你的不能把32位和64位Ruby链接起来。

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

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

这些步骤使用MySQL连接器/C来解决32位与64位的问题。

无论是mysql还是mysql2 gem都应该可以使用它。

票数 2
EN

Stack Overflow用户

发布于 2011-09-07 14:39:48

您是否在Gemfile中包含了mysql2并随后执行了bundle install

票数 0
EN

Stack Overflow用户

发布于 2013-07-27 12:57:21

@@ my sql安装( 64位架构)

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

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

下载mysql

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

用于使用连接器安装mysql的命令

代码语言:javascript
复制
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文件夹

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7328476

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档