gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-30 23:20:25 27 4
gpt4 key购买 nike

环境:

Windows 7 64bit (Home Premium)

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

Rails 3.0.10

MySQL 5.5

Ruby,尽管我已经成功安装了 mysql2,当我调用需要它的 rails 命令时,rubygem 认为 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

注意事项:我注意到它需要 ruby​​gem 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 都应该适用于此。

关于mysql - 终于在 Windows 64 位中安装了 MySQL for Rails,现在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7328476/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com