require mysql do not work

  • Thread starter Guillermo.Acilu
  • Start date
G

Guillermo.Acilu

[Note: parts of this message were removed to make it a legal post.]

Hello guys,

I am new to Ruby. I have been working with the core language so far
without problems. Now I am starting to use mysql.

I have installed it with gem install mysql, and it work perfectly. If I
run gem list, I get the following:

sh-3.2# gem list

*** LOCAL GEMS ***

actionmailer (2.1.0, 1.3.6)
actionpack (2.1.0, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.1.0, 1.15.6)
activeresource (2.1.0)
activesupport (2.1.0, 1.4.4)
acts_as_ferret (0.4.3, 0.4.1)
capistrano (2.3.0, 2.0.0)
cgi_multipart_eof_fix (2.5.0, 2.2)
daemons (1.0.10, 1.0.9, 1.0.7)
dnssd (0.6.0)
fastthread (1.0.1, 1.0)
fcgi (0.8.7)
ferret (0.11.6, 0.11.4)
gem_plugin (0.2.3, 0.2.2)
highline (1.4.0, 1.2.9)
hpricot (0.6)
libxml-ruby (0.5.4, 0.3.8.4)
mongrel (1.1.5, 1.1.4, 1.0.1)
mysql (2.7)
needle (1.3.0)
net-scp (1.0.1)
net-sftp (2.0.1, 1.1.0)
net-ssh (2.0.2, 1.1.2)
net-ssh-gateway (1.0.0)
rails (2.1.0, 1.2.6)
rake (0.8.1, 0.7.3)
RedCloth (3.0.4)
ruby-openid (2.0.4, 1.1.4)
ruby-yadis (0.3.4)
rubygems-update (1.1.1)
rubynode (0.1.5, 0.1.3)
sqlite3-ruby (1.2.2, 1.2.1)
termios (0.9.4)

As you can see mysql 2.7 is installed. When I put the line require "mysql"
in the first line of my program, I get the following error:

sh-3.2# ruby learn.rb
learn.rb:1:in `require': no such file to load -- mysql (LoadError)
from learn.rb:1

I am on Mac OS X 10.5.3 with Ruby 1.8.6, and the outputs included in the
email have been generated with "root". Any ideas why it is not working?

Thanks,

Guillermo
 
L

Luis Lavena

[Note:  parts of this message were removed to make it a legal post.]

Hello guys,

I am new to Ruby. I have been working with the core language so far
without problems. Now I am starting to use mysql.

I have installed it with gem install mysql, and it work perfectly. If I
run gem list, I get the following:

sh-3.2# gem list

*** LOCAL GEMS ***

actionmailer (2.1.0, 1.3.6)
actionpack (2.1.0, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.1.0, 1.15.6)
activeresource (2.1.0)
activesupport (2.1.0, 1.4.4)
acts_as_ferret (0.4.3, 0.4.1)
capistrano (2.3.0, 2.0.0)
cgi_multipart_eof_fix (2.5.0, 2.2)
daemons (1.0.10, 1.0.9, 1.0.7)
dnssd (0.6.0)
fastthread (1.0.1, 1.0)
fcgi (0.8.7)
ferret (0.11.6, 0.11.4)
gem_plugin (0.2.3, 0.2.2)
highline (1.4.0, 1.2.9)
hpricot (0.6)
libxml-ruby (0.5.4, 0.3.8.4)
mongrel (1.1.5, 1.1.4, 1.0.1)
mysql (2.7)
needle (1.3.0)
net-scp (1.0.1)
net-sftp (2.0.1, 1.1.0)
net-ssh (2.0.2, 1.1.2)
net-ssh-gateway (1.0.0)
rails (2.1.0, 1.2.6)
rake (0.8.1, 0.7.3)
RedCloth (3.0.4)
ruby-openid (2.0.4, 1.1.4)
ruby-yadis (0.3.4)
rubygems-update (1.1.1)
rubynode (0.1.5, 0.1.3)
sqlite3-ruby (1.2.2, 1.2.1)
termios (0.9.4)

As you can see mysql 2.7 is installed. When I put the line require "mysql"
in the first line of my program, I get the following error:

sh-3.2# ruby learn.rb
learn.rb:1:in `require': no such file to load -- mysql (LoadError)
        from learn.rb:1

I am on Mac OS X 10.5.3 with Ruby 1.8.6, and the outputs included in the
email have been generated with "root". Any ideas why it is not working?

try this:

require 'rubygems'
require 'mysql'

mysql being installed as gem require you first load rubygems to work
(unless you have RUBYOPT=rubygems which is not your case).

HTH,
 
G

Guillermo.Acilu

[Note: parts of this message were removed to make it a legal post.]

Thank you Luis.

It worked!

Guillermo





From:
Luis Lavena <[email protected]>
To:
(e-mail address removed) (ruby-talk ML)
Date:
09.06.2008 21:25
Subject:
Re: require mysql do not work



[Note: parts of this message were removed to make it a legal post.]

Hello guys,

I am new to Ruby. I have been working with the core language so far
without problems. Now I am starting to use mysql.

I have installed it with gem install mysql, and it work perfectly. If I
run gem list, I get the following:

sh-3.2# gem list

*** LOCAL GEMS ***

actionmailer (2.1.0, 1.3.6)
actionpack (2.1.0, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.1.0, 1.15.6)
activeresource (2.1.0)
activesupport (2.1.0, 1.4.4)
acts_as_ferret (0.4.3, 0.4.1)
capistrano (2.3.0, 2.0.0)
cgi_multipart_eof_fix (2.5.0, 2.2)
daemons (1.0.10, 1.0.9, 1.0.7)
dnssd (0.6.0)
fastthread (1.0.1, 1.0)
fcgi (0.8.7)
ferret (0.11.6, 0.11.4)
gem_plugin (0.2.3, 0.2.2)
highline (1.4.0, 1.2.9)
hpricot (0.6)
libxml-ruby (0.5.4, 0.3.8.4)
mongrel (1.1.5, 1.1.4, 1.0.1)
mysql (2.7)
needle (1.3.0)
net-scp (1.0.1)
net-sftp (2.0.1, 1.1.0)
net-ssh (2.0.2, 1.1.2)
net-ssh-gateway (1.0.0)
rails (2.1.0, 1.2.6)
rake (0.8.1, 0.7.3)
RedCloth (3.0.4)
ruby-openid (2.0.4, 1.1.4)
ruby-yadis (0.3.4)
rubygems-update (1.1.1)
rubynode (0.1.5, 0.1.3)
sqlite3-ruby (1.2.2, 1.2.1)
termios (0.9.4)

As you can see mysql 2.7 is installed. When I put the line require "mysql"
in the first line of my program, I get the following error:

sh-3.2# ruby learn.rb
learn.rb:1:in `require': no such file to load -- mysql (LoadError)
from learn.rb:1

I am on Mac OS X 10.5.3 with Ruby 1.8.6, and the outputs included in the
email have been generated with "root". Any ideas why it is not working?

try this:

require 'rubygems'
require 'mysql'

mysql being installed as gem require you first load rubygems to work
(unless you have RUBYOPT=rubygems which is not your case).

HTH,
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top