If you're using redhat, it's likely you heavily depend on yum to manage your packages. If not, you probably should. Anyhow, I use yum to manage MySQL installation on my RHEL boxes.
Installing MySQL is as easy as:
Installing the MySQL ruby gem
(v 2.8.1) depends on mysql being available in the system. However, this is the error I ran into when installing the gem:
[sakram@rh32 ~]$ ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
checking for mysql_ssl_set()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-mysql-config
/usr/local/lib/ruby/1.9.1/mkmf.rb:364:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/lib/ruby/1.9.1/mkmf.rb:417:in `try_link0'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:421:in `try_link'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:529:in `try_func'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:774:in `block in have_func'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:670:in `block in checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:276:in `block (2 levels) in postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:250:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:276:in `block in postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:250:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:272:in `postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:669:in `checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:773:in `have_func'
from extconf.rb:50:in `main>'
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.8.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
Nothing could be more vague than
"You have to install development tools first.". After hours of scouring the web, thinking it had to do with missing flags etc, turns out, all you have to do is install the mysql-devel package:
In fact, you don't even need to pass the
ARGHFLAGS parameter when installing the gem:
gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
Hope this'll save you time if you come across this post. Cheers.