top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

what is the difference between mysql and mysql2 gem

+6 votes
what is the difference between mysql and mysql2 gem
posted Oct 28, 2013 by Satish Mishra

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+1 vote

In very simple terms, they both do the same things, but the latter is newer and better and faster, and compatible with newer versions of Ruby (and Rails). I think maybe there may be versions of MySQL that are too new for the mysql gem, too, but that's just a guess. Unless you are using Rails 2 under Ruby 1.8.6, I doubt very much that you will need the mysql gem these days, in favor of mysql2.

answer Oct 28, 2013 by Deepak Dasgupta
Similar Questions
+1 vote

I would like to know if this problem is occurs only with me? I was unable to get Mysql2 ou Sqlite3 working with Ruby and rails.

-ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
-Rails 4.0.0.

I tried several tutorials but no one work for me.

See same examples, for sqlite3:

And many others.
I can install de gems but When a run the app it´s simple crash.

+2 votes

I have a rails application, in which I am using delayed_job_active_record gem for running background jobs. While using the method .delay with an object, I am getting the following mysql error:


I already searched for the above error and found that its because of the difference in encoding in mysql and rails. The solution suggested by many programmers is to alter the encoding in mysql database to utf8. But I also read that MySQL's utf8 charset only partially implements proper UTF-8 encoding. It can only store UTF-8-encoded symbols that consist of one to three bytes; encoded symbols that take up four bytes aren't supported. Which might cause trouble in some other cases. Also, when I tried to insert the value directly in mysql, it worked like a charm. Suggesting that the issue might lie elsewhere. So, can anyone please suggest the right method to rectify this problem?

Any help would be greatly appreciated.

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.