1

我是 RoR 编程新手。我在尝试在简单的 RoR 项目上启动 webrick 网络服务器时遇到错误,同时在提示命令行中键入以下代码:

“轨道服务器”

我收到了这个错误:

C:\Users\dell\sites\simple_cms>rails s
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.
rb:2:in `require': 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 (LoadError)
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/m
ysql2/mysql2.rb:2:in `<top (required)>'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/m
ysql2.rb:9:in `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/m
ysql2.rb:9:in `<top (required)>'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runti
me.rb:68:in `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runti
me.rb:68:in `block (2 levels) in require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runti
me.rb:66:in `each'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runti
me.rb:66:in `block in require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runti
me.rb:55:in `each'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runti
me.rb:55:in `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler.rb:12
8:in `require'
        from C:/Users/dell/sites/simple_cms/config/application.rb:7:in `<top (re
quired)>'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/comman
ds.rb:53:in `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/comman
ds.rb:53:in `block in <top (required)>'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/comman
ds.rb:50:in `tap'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/comman
ds.rb:50:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

我从这里(和许多其他人)尝试了解决方案: Ruby mysql2 Error http://railsforum.com/viewtopic.php?id=50501 他们没有用。

我的细节:

windows 7 64 bit
mysql  Ver 14.14 Distrib 5.5.28, for Win64 (x86)
ruby 1.9.3p327 (2012-11-10) [i386-mingw32]
Rails 3.2.9
gem 1.8.24
4

2 回答 2

1

由于此链接,提示命令:“rails server”再次运行:

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

这对于在 Windows 7 X64 上正确安装 mysql 和 rails 非常有帮助。

于 2013-01-06T17:15:14.893 回答
0

您需要从 MySql 安装目录中复制libmysql.dll并将其粘贴到ruby​​193/bin ....

于 2013-01-05T17:41:11.170 回答