LoadError: cannot load such file -- dbd-mysql

782 views Asked by At

i could use a little assistance... I have searched everywhere and can't seem to find anything pertaining to this particular gem throwing errors. I just installed dbi mysql and dbd-mysql gems just fine but when i loaded up IRB to make sure everything was working, the first two loaded just fine (require 'dbi' =>true) but require 'dbd-mysql' gives me:

LoadError: cannot load such file -- dbd-mysql
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from (irb):2
from /usr/bin/irb:11:in `<main>'

the only thing ive found close to this issue is a similar error when requiring mysql but that was fixed by require 'rubygems' which i tried and didn't help. can anyone shed any further light on this? i would appreciate it greatly!

1

There are 1 answers

0
Kimmo Lehto On

First, the dbd-mysql gem is pretty much antique.

Looking at the documentation it seems that you're not supposed to require it. Just install and then use :

DBI.connect('DBI:Mysql:test', 'testuser', 'testpwd')

Which will probably complain if dbd-mysql is not installed. If you want to require it, you could try:

require 'dbd/Mysql'

or:

require 'dbi/dbd/Mysql'

You may want to use the more modern and up to date mysql2 gem instead.