简体   繁体   English

在Windows中为Ruby on Rails设置Mysql

[英]Setting up Mysql for Ruby on Rails in Windows

I'm on Windows, and I have a working Rails 2.3.8 app on Ruby 1.8.6 with MySQL 5.0 and the mysql gem version 2.8.1. 我在Windows上,并且在具有MySQL 5.0和mysql gem 2.8.1的Ruby 1.8.6上有一个可以正常工作的Rails 2.3.8应用程序。 It all works. 一切正常。

I just installed Ruby 1.9.1, installed gems for rails(2.3.8) and mysql. 我刚刚安装了Ruby 1.9.1,为rails(2.3.8)和mysql安装了gems。 BUT NOW when I run ruby script/server: 现在,当我运行ruby脚本/服务器时:

!!! The bundled mysql.rb driver has been removed from Rails 2.2. 捆绑的mysql.rb驱动程序已从Rails 2.2中删除。 Please install the mysql gem and try again: gem install mysql. 请安装mysql gem,然后重试:gem install mysql。

I ALREADY INSTALLED IT! 我已经安装了!

One thing that might be a problem: When I run "gem list" in my working ruby (v1.8.6) install, it lists "mysql (2.8.1)". 可能是一个问题:在我工作的ruby(v1.8.6)安装中运行“ gem list”时,它列出了“ mysql(2.8.1)”。 BUT when I run "gem list" in the new ruby install (v1.9.1), it lists "mysql (2.8.1 x86-mingw32)". 但是,当我在新的ruby安装(v1.9.1)中运行“ gem列表”时,它列出了“ mysql(2.8.1 x86-mingw32)”。 If that's the cause, how do I fix it? 如果那是原因,我该如何解决? If it's not, what on earth is keeping Rails from recognizing the installed mysql gem? 如果不是,到底是什么使Rails无法识别已安装的mysql gem?

Thanks in advance. 提前致谢。 I'm sure this is a common upgrade path, so I can't be the only one with this problem... 我确定这是一条常见的升级途径,所以我不能成为唯一一个存在此问题的人...

Finally got some solid info. 终于得到了一些可靠的信息。

Apparently the mysql gem sucks, and shouldn't be relied on going forward. 显然,mysql gem很烂,因此不应依赖于前进。 That's why Rails 3.0.0 officially endorses the mysql2 gem instead ( gem install mysql2 ), which unfortunately is not supported under Windows yet, though the gem's developer seems to be working on it . 这就是Rails 3.0.0正式认可mysql2 gem的原因( gem install mysql2 ),不幸的是Windows尚不支持它,尽管gem的开发人员似乎正在研究它

As I try to get my app to Rails 3, I'm just going to make the easy switch to sqlite3 until there's a good mysql gem for windows. 当我尝试将我的应用程序安装到Rails 3时,我将轻松切换到sqlite3,直到有一个适用于Windows的mysql gem。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM