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.
3 Answers
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.

- 1
- 1

- 28,118
- 6
- 68
- 71
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.

- 63,433
- 20
- 141
- 111
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

- 2,183
- 2
- 20
- 32