1

当我点击命令为 Rails 服务器加注星标时,我总是收到以下消息:

C:/Ruby/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:
2:in `require': 193: %1 is not a valid Win32 application.   - C:/Ruby/lib/ruby/g
ems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/1.9/mysql2.so (LoadError)
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysq
l2/mysql2.rb:2:in `<top (required)>'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysq
l2.rb:9:in `require'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysq
l2.rb:9:in `<top (required)>'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.
rb:68:in `require'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.
rb:68:in `block (2 levels) in require'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.
rb:66:in `each'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.
rb:66:in `block in require'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.
rb:55:in `each'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler/runtime.
rb:55:in `require'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/lib/bundler.rb:128:i
n `require'
        from D:/Ruby/Rails/simple_cms/config/application.rb:7:in `<top (required
)>'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.
rb:53:in `require'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.
rb:53:in `block in <top (required)>'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.
rb:50:in `tap'
        from C:/Ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.
rb:50:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

我正在使用 mysql2 gem,并且正在尝试使用 WampServer 中的 mysql。

谢谢你的帮助。

4

1 回答 1

0

我猜你正在寻找以下内容:

红宝石mysql2错误

安装 gem 后,执行以下操作:

安装 mysql2 gem,路径指向您安装 MySQL 连接器库和包含的位置。

注意:确保您确实有单引号 ('),如下所示:

gem install mysql2 -- '--with-mysql-lib="C:...\MySQL 连接器 C 6.0.2\lib\opt" --with-mysql-include="C:...\MySQL 连接器 C 6.0.2\包括"'

于 2013-01-02T22:04:32.493 回答