0

当我运行 rails server 时,它会显示如下错误消息:

`require': Incorrect MySQL client library version! This gem was compiled for 6.0.0 but the client library is 5.1.42. (RuntimeError)
        from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql-2.9.1-x86-mingw32/lib/mysql.rb:4:in `<top (required)>'
        from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
        from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
        from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
        from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
        from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
        from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
        from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'

我安装了 Mysql 5.1 数据库。

在我的 gem 文件中,我写了这个:

gem 'mysql'

然后运行捆绑安装

是什么导致了这个问题?

4

2 回答 2

2

试试这个

添加你的 Gemfile

 gem 'mysql2'

然后进行捆绑安装,并在命令行运行此命令来安装这些软件包。

   sudo apt-get install mysql-client libmysqlclient-dev

在窗户上

将 libmysql.dll 从 mysql 安装文件夹复制到系统上的 Ruby bin 目录。

于 2013-08-14T11:34:31.667 回答
0

我认为您应该尝试包含 mysql2 gem,在您的 gemfile 中添加:

gem 'mysql2'
于 2013-08-14T10:26:05.857 回答