Questions tagged [mysql2]

The Mysql2 gem is meant to serve the extremely common use-case of connecting, querying and iterating on results.

The mysql2 gem is an interface for accessing MySQL databases from Ruby. This gem is an incompatible improvement over the original mysql gem.

Links:

907 questions
0
votes
1 answer

Heroku, data import error with mysql2

I am beginner on Heroku. I push my exist ruby on rails application into heroku and that was fine. Next i push my mysql data into heroku with 'push' command as following. $heroku config:add DATABASE_URL='mysql2://
onoke
  • 79
  • 6
0
votes
1 answer

Upgrading Rails 3 app from Ruby 1.8.7 to 1.9.3 stops respecting latin1 encoding specification in database.yml

I'm upgrading a Rails 3.2.13 application from Ruby 1.8.7-p370 to Ruby 1.9.3-p385. After upgrading, special characters are garbled in text retrieved from the database. For instance "café" appears as "café". My database is latin1 encoded. I'm using…
hoffm
  • 2,386
  • 23
  • 36
0
votes
1 answer

Failed to install mysql2 gem on RHEL 5.8 through bundler

Here is my stack: RHEL 5.8 x86_64 MySQL 5.5 x86_64 Ruby 1.9.3p345 Rails 3.2.8 I am installing mysql2 0.3.11 gem through bundler and got the error, and the problem seems not to be the same with the popular errors at Ruby gem mysql2 install failing…
Xiaoli
  • 73
  • 8
0
votes
1 answer

Error loading mysql2 when trying to run ruby app on localhost

I'm trying to run a ruby app i cloned from github on mylocalhost and get the following error when entering 'rails s' in the command: C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require':…
Uri Klar
  • 3,800
  • 3
  • 37
  • 75
0
votes
2 answers

Heroku database configuration specifies nonexistent mysql adapter

I can't seem to overcome the above error on heroku. I am running rails 3 with the mysql2 gem locally just fine, but this seems to break when moving to heroku. First, I am using ClearDB. Second, when I deploy and try to run heroku run rake…
Shawn Deprey
  • 467
  • 8
  • 27
0
votes
2 answers

Insert Multiple Rows using MySQL INSERT VALUES syntax

I am looking for a ruby-specific solution to insert multiple rows using the INSERT..VALUES syntax Currently I am generating individual insert statements, but this is very inefficient from a database perspective. I found some related questions, but…
Garren S
  • 5,552
  • 3
  • 30
  • 45
0
votes
2 answers

mysql2 gem install error

im trying to install mysql2 gem after it failed to install on a bundle install. when i run $ sudo gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config i get the following error: Building native extensions. This could…
0
votes
1 answer

Some combo of Rails 3.2.8+ & MySQL not playing well together

We are in the process of upgrading to Ruby 1.9.3 from 1.8.7 plus trying to update Rails from 3.2.1 to 3.2.8 or 9. Our app works with Ruby 1.9.3-p327 and Rails 3.2.1, but as soon as I upgrade Rails to any higher version, I start seeing MySQL…
juicedM3
  • 501
  • 5
  • 5
0
votes
1 answer

Rails mysql2 migration breaks utf8 strings

I'm migrating old mysql database to new one so I wrote a script that connects to old database, reads it and creates new entities in new database. Here it is: old_db = Mysql2::Client.new(host: options[:db_host], username:…
Pavel S
  • 389
  • 1
  • 9
0
votes
1 answer

How to manage mysql2 connections in rails, without using activerecord

I perodicially need to access a mysql database, my primary data store is mongo, which I access with mongoid. I want to know the best way to manage connections to mysql (with the mysql2 gem - 0.2.7) without using active record. I current do the…
Jonathan
  • 16,077
  • 12
  • 67
  • 106
0
votes
1 answer

rake 0.9.2 isn't recognized in bundle exec

This is the error I get when I run db:migrate. rake db:migrate rake aborted! You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. Using bundle exec may solve this. I then run bundle exec rake 0.9.2 and this is what I get …
0
votes
1 answer

While using ActiveRecord why is Mysql2::Error raised and not an Activerecord error?

I am using ActiveRecord to create a connection to a database in a thor script. The adapter I am using in this case is mysql2. I want to add some rescue blocks to my code in order to offer some specific error messages to users. When I turn off the…
Satyam
  • 645
  • 2
  • 7
  • 20
0
votes
1 answer

Error when I make a connection through sequel - mysql2 on AmazonWs

My rb file is simple like this: require 'rubygems' require 'mysql2' require 'sequel' Sequel.connect(:adapter => 'mysql2', :database=>'xxx', :user => 'xxx', :password => 'xxxxxx', :host => 'xxxxxxxx.compute-1.amazonaws.com') when I ran this file I…
0
votes
3 answers

Rails - Connecting to MySQL as root

I am currently using MySQL for my Rails application. In my database.yml, I have the following: production: adapter: mysql2 database: application_name_production username: root password: password host: localhost I'm wondering, is it ok to…
gerky
  • 6,267
  • 11
  • 55
  • 82
0
votes
1 answer

why the belongs to association return a Fixnum object

rails 3.2.2 mysql2 I have the following relationships, class TalkingCase < ActiveRecord::Base belongs_to :medical_case end class MedicalCase < ActiveRecord::Base has_many :talking_cases end in the…
javy_liu
  • 1
  • 2