Help with gem ruby mysql error

A

Andrew Ting

Hi,

I downloaded & double clicked 3 files to install mysql 5.1 for MacOS,
but i get the following errors, can someone advise please?

Thanks!

Ad

======================================================

sudo gem install mysql -- --with-mysql-config=/path/to/mysql_config
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb --with-mysql-config=/path/to/mysql_config
extconf.rb:10: command not found: /path/to/mysql_config --cflags
Gem files will remain installed in
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out


And when i ran one ruby program :-


$ ruby blog.rb
/Library/Ruby/Gems/1.8/gems/sequel-3.7.0/lib/sequel/adapters/mysql.rb:2:
LoadError: require 'mysql' did not define Mysql::CLIENT_MULTI_RESULTS!
(Sequel::AdapterNotFound)
You are probably using the pure ruby mysql.rb driver,
which Sequel does not support. You need to install
the C based adapter, and make sure that the mysql.so
file is loaded instead of the mysql.rb file.
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from
/Library/Ruby/Gems/1.8/gems/sequel-3.7.0/lib/sequel/core.rb:165:in
`require'
from
/Library/Ruby/Gems/1.8/gems/sequel-3.7.0/lib/sequel/core.rb:165:in
`each'
from
/Library/Ruby/Gems/1.8/gems/sequel-3.7.0/lib/sequel/core.rb:165:in
`require'
from
/Library/Ruby/Gems/1.8/gems/sequel-3.7.0/lib/sequel/database.rb:111:in
`adapter_class'
from
/Library/Ruby/Gems/1.8/gems/sequel-3.7.0/lib/sequel/database.rb:140:in
`connect'
from
/Library/Ruby/Gems/1.8/gems/sequel-3.7.0/lib/sequel/core.rb:100:in
`connect'
from ./data/init.rb:7
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from blog.rb:7
 
P

Phillip Gawlowski

Hi,

I downloaded& double clicked 3 files to install mysql 5.1 for MacOS,
but i get the following errors, can someone advise please?

Thanks!

Ad

======================================================

sudo gem install mysql -- --with-mysql-config=/path/to/mysql_config

Is that verbatim? If so, you need to replace /path/to/mysql_config with
the actual path to your mysql_config file (dunno whcih one is meant,
maybe my.cnf?).

Finder could help you, once you know which sort of config file is meant. :)
 
A

Andrew Ting

Yes thanks Philip, about the verbatim.

Anyone with any experience on this?

:)

============================================

Some of the cnf files found, which should be used?

/opt/local/var/macports/sources/rsync.macports.org/release/ports/databases/mysql4/files/my.cnf
/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/federated/my.cnf
/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/ndb/my.cnf
/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/rpl/my.cnf
/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/rpl_ndb/my.cnf


==============================================


i found a few my.cnf found and replaced with say:-

sudo gem install mysql --
--with-mysql-config=/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/rpl_ndb/my.cnf

but got the following error :-

$ sudo gem install mysql --
--with-mysql-config=/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/rpl_ndb/my.cnf
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb
--with-mysql-config=/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/rpl_ndb/my.cnf
extconf.rb:10: command not found:
/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/rpl_ndb/my.cnf
--cflags


Gem files will remain installed in
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to
/Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
 
P

Phillip Gawlowski

Yes thanks Philip, about the verbatim.

It's Phillip, but you are still welcome. ;)
/opt/local/var/macports/sources/rsync.macports.org/release/ports/databases/mysql4/files/my.cnf
This seems like the correct one.
/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/federated/my.cnf
/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/ndb/my.cnf
/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/rpl/my.cnf
/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/rpl_ndb/my.cnf

These seem to be config files for MySQL's test, looking at the path.

So, with any luck, if you use
/opt/local/var/macports/sources/rsync.macports.org/release/ports/databases/mysql4/files/my.cnf,
you should be finally set. :)
 
H

Hassan Schroeder

Some of the cnf files found, which should be used?

/opt/local/var/macports/sources/rsync.macports.org/release/ports/databases/mysql4/files/my.cnf
/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/federated/my.cnf
/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/ndb/my.cnf
/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/rpl/my.cnf
/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/rpl_ndb/my.cnf

None of the above --
i found a few my.cnf found and replaced with say:-

sudo gem install mysql --
--with-mysql-config=/usr/local/mysql-5.1.41-osx10.5-x86/mysql-test/suite/rpl_ndb/my.cnf

--with-mysql-config=/usr/local/mysql-5.1.41-osx10.5-x86/bin/mysql_config

is what you're looking for...

(The 'my.cnf' files are runtime configurations; you would copy an
appropriate version to /etc/my.cnf, but don't worry about that now.)

HTH,
 
A

Andrew Ting

Thanks Phillip and Hassan, path is correct now but below error is still
appearing.

any advise?

:)


$ruby blog.rb
/Library/Ruby/Gems/1.8/gems/sequel-3.7.0/lib/sequel/adapters/mysql.rb:2:
LoadError: require 'mysql' did not define Mysql::CLIENT_MULTI_RESULTS!
(Sequel::AdapterNotFound)
You are probably using the pure ruby mysql.rb driver,
which Sequel does not support. You need to install
the C based adapter, and make sure that the mysql.so
file is loaded instead of the mysql.rb file.
 
H

Hassan Schroeder

Thanks Phillip and Hassan, path is correct now but below error is still
appearing.

any advise?
$ruby blog.rb
/Library/Ruby/Gems/1.8/gems/sequel-3.7.0/lib/sequel/adapters/mysql.rb:2:
LoadError: require 'mysql' did not define Mysql::CLIENT_MULTI_RESULTS!
(Sequel::AdapterNotFound)

Sorry, I don't know anything about this "sequel" gem.

Are you saying that `sudo gem install mysql` completed successfully,
and `gem list --local` shows it's installed?

If so, can you use it directly from irb?
 
A

Andrew Ting

gem list will show
mysql (2.8.1) installed

Oh yes, modify above to correct path and installation is successful.

But mysql.so not found error is still valid.

(I'm not good at irb.)

I wondered what is left out?

Downloaded mysql5.1 and installed.

Probably i should specify mysql version 5.1 to be installed with gem
instead??

Any suggestions? Thanks
 
H

Hassan Schroeder

gem list will show
mysql (2.8.1) installed

Oh yes, modify above to correct path and installation is successful.

But mysql.so not found error is still valid.

(I'm not good at irb.)

I wondered what is left out?

Downloaded mysql5.1 and installed.

? why would you do that before getting your gem situation straightened out?

I would stick with the one you used to install the gem for now.

You can check with, e.g.
prompt% irb
where the last three parameters match your installation.

You should get something back like

=> #<Mysql:0x101ff4248>
 
A

Andrew Ting

Hmmm,
NoMethodError: undefined method `connect' for Mysql:Class
from (irb):3

Now, i got to say i'm not sure where i can find the user, password and
database for now, but above show undefined method even before
authentication...

What else can be done?

Thanks!
 
H

Hassan Schroeder

NoMethodError: undefined method `connect' for Mysql:Class
=A0from (irb):3
Now, i got to say i'm not sure where i can find the user, password and
database for now, but above show undefined method even before
authentication...

Yeah, that sounds completely broken. You could try (in irb)
just for the heck of it, but I think you need to delete that gem entirely
and rebuild, against whatever version of MySQL you plan to use.

Good luck!
--=20
Hassan Schroeder ------------------------ (e-mail address removed)
twitter: @hassan
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top