1

I have simple question is mysql2 gem is mandatory with rails3 or is it possible to use old mysql gem,What are the major difference between them,can anyone elaborate on this.

Matt Briggs
  • 41,224
  • 16
  • 95
  • 126
Lohith MV
  • 3,798
  • 11
  • 31
  • 44

3 Answers3

0

It is not required that you use it. But it is recommended. A good answer explaining its benefits can be found here:

Ruby, Rails: mysql2 gem, does somebody use this gem? Is it stable?

I'm currently using it production for 2 apps and it has been very stable.

Community
  • 1
  • 1
Chris Cherry
  • 28,118
  • 6
  • 68
  • 71
0

It is not mandatory, I use:

gem 'mysql'

in my projects.

in terms of the difference, here is a snippet out of https://github.com/brianmario/mysql2

Someone: Dude, the Mysql gem works fiiiiiine.

Me: It sure does, but it only hands you nil and strings for field values. Leaving you to convert them into proper Ruby types in Ruby-land - which is slow as balls.

Someone: OK fine, but do_mysql can already give me back values with Ruby objects mapped to MySQL types.

Me: Yep, but it’s API is considerably more complex and can be ~2x slower.

Also if you scroll down to the page, you can see benchmarks which show in fact that mysql2 may be better in terms of performance.

Mike Lewis
  • 63,433
  • 20
  • 141
  • 111
0

To use Mysql instead of MySql2, change mysql2 to mysql in Gemfile & database.yml. For details, refer to

http://rorguide.blogspot.com/2011/03/browser-reloads-again-again-with-status.html

Ritesh Kumar
  • 2,183
  • 2
  • 20
  • 32