no such file to load -- mysql (LoadError)

Discussion in 'Ruby' started by Ani T., Nov 9, 2010.

  1. Ani T.

    Ani T. Guest

    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

    --
    Posted via http://www.ruby-forum.com/.
     
    Ani T., Nov 9, 2010
    #1
    1. Advertising

  2. Ani T.

    Ryan Davis Guest

    On Nov 8, 2010, at 19:52 , Ani T. wrote:

    > 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.
     
    Ryan Davis, Nov 9, 2010
    #2
    1. Advertising

  3. Ani T.

    Ani T. Guest

    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


    --
    Posted via http://www.ruby-forum.com/.
     
    Ani T., Nov 9, 2010
    #3
  4. "Ani T." <> wrote in message
    news:...
    > 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
     
    Michael Brooks, Nov 9, 2010
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ruby Ruby
    Replies:
    0
    Views:
    191
    Ruby Ruby
    Apr 22, 2004
  2. Brian Takita
    Replies:
    7
    Views:
    320
    Brian Takita
    May 24, 2005
  3. Zoong Pham
    Replies:
    1
    Views:
    286
    Chad Fowler
    Aug 11, 2005
  4. Replies:
    1
    Views:
    336
    Eric Hodel
    Oct 25, 2005
  5. Michael Andreasen
    Replies:
    7
    Views:
    169
    John Joyce
    Sep 22, 2007
Loading...

Share This Page