首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Windows环境下的Mysql2和Rails

Windows环境下的Mysql2和Rails
EN

Stack Overflow用户
提问于 2013-01-04 01:45:02
回答 2查看 2.6K关注 0票数 2

所以。我正在尝试开发一个rails应用程序,并试图在Windows 7中这样做。

  1. 使用rubyinstaller安装Ruby 1.9.3
  2. gem update
  3. gem install rails
  4. gem update
  5. rails new
  6. 修改the文件,将sqlite3替换为mysql2
  7. 正确修改database.yml
  8. bundle install
  9. gem update
  10. 将mysql添加到我的路径中
  11. 在ruby bin中向libmysql c连接器添加了一个硬链接

到目前为止,所有事情都正常工作,除了我做rake db:create:all时,结果是:

代码语言:javascript
复制
rake aborted!
126: The specified module could not be found.   - C:/Ruby193/lib/ruby/gems/1.9.1
/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/1.9/mysql2.so
C:/Users/username/Documents/workspace/appname/config/application.rb:7:in `<top (
required)>'
C:/Users/username/Documents/workspace/appname/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)

见鬼?

更新:

全部追踪,按要求:

代码语言:javascript
复制
rake aborted!
126: The specified module could not be found.   - C:/Ruby193/lib/ruby/gems/1.9.1
/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/1.9/mysql2.so
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.
rb:2:in `require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.
rb:2:in `<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in
 `require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in
 `<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `
require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `
block (2 levels) in require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `
each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `
block in require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `
each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `
require'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler.rb:128:in `require
'
C:/Users/mschultz/Documents/workspace/recruit/config/application.rb:7:in `<top (
required)>'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
C:/Users/mschultz/Documents/workspace/recruit/Rakefile:5:in `<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `l
oad'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `l
oad_rakefile'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:583:in `
raw_load_rakefile'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:89:in `b
lock in load_rakefile'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `
standard_exception_handling'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:88:in `l
oad_rakefile'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:72:in `b
lock in run'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `
standard_exception_handling'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in `r
un'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-10.0.3/bin/rake:33:in `<top (required)>
'
C:/Ruby193/bin/rake:23:in `load'
C:/Ruby193/bin/rake:23:in `<main>'

宝石档案:

代码语言:javascript
复制
source 'https://rubygems.org'

gem 'rails', '3.2.9'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mysql2'

gem 'json'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
gem 'capistrano'

# To use debugger
# gem 'ruby-debug'
EN

回答 2

Stack Overflow用户

发布于 2013-05-01 11:21:47

我使用的是railsinstaller解决方案:如果要创建带有-- libmysql.dll =mysql参数的应用程序,就必须将其添加到Ruby中,如果要创建带有--database=mysql参数的应用程序,则必须从包安装程序中添加它的提示。

票数 2
EN

Stack Overflow用户

发布于 2013-01-04 23:24:26

请允许我推荐。

http://railsinstaller.org/

是安装rails的最简单方法。确保它符合正确的系统软件。

不过,我不认为这是你的安装。我想是你改变了你的数据库。首先,我建议使用PG,我认为它比sql2或sql3好得多。

但是,考虑到您出于某种原因想要sql2,我认为修改后的database.yml是关闭的。你说它是正确的,但你可能想再检查一遍。

我不是专家,但也许这里有什么有用的东西。否则,祝你好运!

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

https://stackoverflow.com/questions/14149969

复制
相关文章

相似问题

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