no such file to load -- mysql (LoadError)

A

Ani T.

Hi! I am new to Ruby and just installed RadRails and also did gem
install mysql and specifiled the path as
C:\Ruby\lib\ruby\gems\1.8\gems\mysql-2.7.3-x86-mswin32\ext
when i run the following:

require 'mysql'
if __FILE__ == $0
# TODO Generated stub
print "Hello\n"
end

I am getting the following error
test1.rb:4:in `require': no such file to load -- mysql (LoadError)
from test1.rb:4

Can someone please help? I've looked at available posts and could not
find a solution... have been trying to find a solution to this
problem for 2 days but not getting anywhere. Any help is much
appreciated.

Thanks.
Ani
 
R

Ryan Davis

Hi! I am new to Ruby and just installed RadRails and also did gem
install mysql and specifiled the path as
C:\Ruby\lib\ruby\gems\1.8\gems\mysql-2.7.3-x86-mswin32\ext
when i run the following:
=20
require 'mysql'
if __FILE__ =3D=3D $0
# TODO Generated stub
print "Hello\n"
end
=20
I am getting the following error
test1.rb:4:in `require': no such file to load -- mysql (LoadError)
from test1.rb:4

You're running 1.8 so you need to add "require 'rubygems'" before your =
"require 'mysql'" line.
 
A

Ani T.

Hi Ryan, Thanks for your post.

I inserted "require 'rubygems'" and am now getting the following error:
C:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so:
126: The specified module could not be found. -
C:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so
(LoadError)
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`require'
from test1.rb:4

I checked the locatins above and the mysql.so and custom_require.rb
files exist...not sure why it is giving the error...thanks in advance
for your help. I've attached screenshots incase it is helpful.

Ani

Attachments:
http://www.ruby-forum.com/attachment/5324/1-ruby.JPG
http://www.ruby-forum.com/attachment/5325/2-ruby.JPG
http://www.ruby-forum.com/attachment/5326/3-ruby.JPG
http://www.ruby-forum.com/attachment/5327/4-ruby.jpg
 
M

Michael Brooks

Ani T. said:
Hi Ryan, Thanks for your post.

I inserted "require 'rubygems'" and am now getting the following error:
C:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so:
126: The specified module could not be found. -
C:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so
(LoadError)
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`require'
from test1.rb:4

I checked the locatins above and the mysql.so and custom_require.rb
files exist...not sure why it is giving the error...thanks in advance
for your help. I've attached screenshots incase it is helpful.

Ani

Hello Ani:

This might not make a difference but is the location of the "libmySQL.dll"
file (usually the mysql/bin folder) in your systems $PATH environment
variable. I haven't tried using MYSQL with Ruby but recently on Windows
Vista 64 when developing with Delphi XE I've noticed that the mysql dll
needs to be in the $PATH variable. In the old days I could drop that dll
into the application folder but that doesn't seem to work for me anymore so
you might be experiencing the same thing.

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,930
Messages
2,570,072
Members
46,522
Latest member
Mad-Ram

Latest Threads

Top