1
votes

I have a ruby script that I have written and I am trying to use if to write to an active record database that I have created. When I add a require 'mysql12' to the file I get the following error:

.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:106:in `require': cannot load such file -- mysql12 (LoadError)

When I do a

gem list | grep mysql
activerecord-mysql2-adapter (0.0.3)
mysql2 (0.3.11)

it shows that the mysql12 gem is installed.

My database.yml file for the project looks like this:

production:
  adapter: mysql2
  encoding: utf8
1
Should it be require 'mysql12' or require 'mysql2'?vee
I believe it should be require 'mysql12'rahrahruby
You were right, I'm embrassed to say that I had a 12 in mysql intead of mysql2. Please make it an offical answer so that I can give you credit for it. Thanksrahrahruby
Nice! There you go, added an answer :)vee

1 Answers

3
votes

When I add a require 'mysql12' to the file I get the following error:

.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:106:in `require': cannot load such file -- mysql12 (LoadError).

As commented above updating the require statement to require 'mysql2' in your ruby script should fix the error.