【问题标题】:Can't start WEBRick web server - Ruby is throwing MySQL errors无法启动 WEBRick Web 服务器 - Ruby 抛出 MySQL 错误
【发布时间】:2014-03-05 20:17:03
【问题描述】:

我是使用 64 位计算机的 Windows 8.1 用户。但是,我已经安装了所有关于 Ruby 的 32 位版本,以防止互联网上的那些著名错误。这还不够……在尝试启动提到 MySQL 的 Rails 的 WEBBrick 服务器时,我仍然收到一个奇怪的错误:

C:\Users\User\Workspace\Ruby\ruby_learn>rails server
C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:in `require':
Incorrect MySQL client library version! This gem was compiled for 6.1.3 but the
client library is 6.0.0. (RuntimeError)
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:i
n `<top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runti
me.rb:76:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runti
me.rb:76:in `block (2 levels) in require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runti
me.rb:72:in `each'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runti
me.rb:72:in `block in require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runti
me.rb:61:in `each'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runti
me.rb:61:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler.rb:13
1:in `require'
        from C:/Users/User/Workspace/Ruby/ruby_learn/config/application.rb:7:in
`<top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/comman
ds.rb:76:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/comman
ds.rb:76:in `block in <top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/comman
ds.rb:73:in `tap'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/comman
ds.rb:73:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

前几天我确实在让 MySQL 工作时遇到了一些麻烦,但我通过使用 MySQL C Connector 6.0.2 做了一些我不理解的事情来解决它,然后早些时候我无法安装捆绑包,因为它要求 mysql2 0.3.15,但我显然有 mysql2 0.3.13。我不确定哪里错了。因此,我从 dev.mysql.com 获得的更新后的 C 连接器修复了捆绑包问题,但现在 Web 服务器无法运行。

我不知道设置 Ruby on Rails 会如此痛苦,但我仍然对此充满动力,我需要帮助才能继续。

谢谢。

【问题讨论】:

  • 你试过运行bundle exec rails server吗?
  • 不,我不知道。现在我运行它,我仍然得到同样的错误。 :\
  • 添加Gemfile gem 'mysql2'

标签: mysql ruby-on-rails ruby


【解决方案1】:

我希望这能解决你的问题..

Incorrect MySQL client library version

我遇到了同样的问题并从这里安装了 Mysql 客户端库

http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick

下载并将lib\libmysql.dll文件放到你的Ruby bin目录下,例如 C:\Ruby\bin

【讨论】:

    【解决方案2】:

    试试看这个答案是否对你有帮助mysql2 gem compiled for wrong mysql client library

    当您 gem install mysql2 时会显示一条有用的消息。不幸的是,如果您使用 Bundler 安装 gem,Bundler 会吃掉消息

    【讨论】:

      猜你喜欢
      • 2015-01-09
      • 2012-05-20
      • 1970-01-01
      • 2013-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-29
      • 1970-01-01
      相关资源
      最近更新 更多