Help with gem ruby mysql error

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:inrequire’
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:ineach’
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:inadapter_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:inconnect’
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:inrequire’
from blog.rb:7

On 21.12.2009 20:07, Andrew T. wrote:

Yes thanks Philip, about the verbatim.

It’s Phillip, but you are still welcome. :wink:

/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. :slight_smile:

On 21.12.2009 15:24, Andrew T. wrote:

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.
:slight_smile:

Yes thanks Philip, about the verbatim.

Anyone with any experience on this?

:slight_smile:

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

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

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

any advise?

:slight_smile:

$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.

On Mon, Dec 21, 2009 at 11:07 AM, Andrew T. [email protected]
wrote:

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,

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

On Tue, Dec 22, 2009 at 12:26 AM, Andrew T. [email protected]
wrote:

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?

Hmmm,

require ‘rubygems’
=> false

require ‘mysql’
=> true

db = Mysql.connect(“localhost”, “user”,“password”, “database”)
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!

On Tue, Dec 22, 2009 at 8:37 AM, Andrew T. [email protected] wrote:

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

require ‘rubygems’
=> false
require ‘mysql’
=> true
db = Mysql.connect(“localhost”, “user”,“password”, “database”)

where the last three parameters match your installation.

You should get something back like

=> #Mysql:0x101ff4248

On Wed, Dec 23, 2009 at 11:05 AM, Andrew T. [email protected]
wrote:

db = Mysql.connect(“localhost”, “user”,“password”, “database”)
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…

Yeah, that sounds completely broken. You could try (in irb)

Mysql.methods

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!