0

When I run rails server it shows errors message like this:

`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'

I installed Mysql 5.1 database.

In my gem file I wrote this:

gem 'mysql'

then run bundle install

What causes this problem?

James Dunn
  • 8,064
  • 13
  • 53
  • 87
Tatarao voleti
  • 513
  • 3
  • 7
  • 23
  • mysql is a very old gem, try with mysql2 – apneadiving Aug 14 '13 at 10:24
  • @apneadiving , when installing mysql2 gem , got the fallowing error.Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. – Tatarao voleti Aug 14 '13 at 10:29
  • heres a question about that error http://stackoverflow.com/questions/15816331/geminstallerextensionbuilderror-error-failed-to-build-gem-native-extension , – ajt Aug 14 '13 at 11:23

2 Answers2

2

try this out

add in you Gemfile

 gem 'mysql2'

and then do bundle install, and run this command at the command line to install these packages.

   sudo apt-get install mysql-client libmysqlclient-dev

on windows

copy libmysql.dll from mysql installation folder to your Ruby bin directory on your system.

Sachin Singh
  • 7,107
  • 6
  • 40
  • 80
0

I think you should try including mysql2 gem instead, in your gemfile just add:

gem 'mysql2'
Gnagno
  • 597
  • 1
  • 6
  • 18
  • when installing mysql2 gem , got the fallowing error.Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. – Tatarao voleti Aug 14 '13 at 10:59
  • @SanjaySahu http://stackoverflow.com/questions/10051448/error-failed-to-build-gem-native-extension-mysql2-on-rails-3-2-3 – ajt Aug 14 '13 at 11:27