title: MySQL Gem installation error on Rails
body: <p>I am deploying my Rails application using Chef. While </p>
  
  <blockquote>
    <p>gem install mysql </p>
  </blockquote>
  
  <p>am getting hte following error, </p>
  
  <blockquote>
    <p>Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
    extension.</p>
    
    <p>/opt/chef/embedded/bin/ruby extconf.rb  checking for
    mysql_ssl_set()... <strong>* extconf.rb failed *</strong> 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.</p>
    
    <p>Provided configuration options:   --with-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=/opt/chef/embedded/bin/ruby  --with-mysql-config
      --without-mysql-config
    /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:381:in <code>try_do': The
    compiler failed to generate an executable file. (RuntimeError) You
    have to install development tools first.  from
    /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:461:in</code>try_link0'  from
    /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:476:in <code>try_link'   from
    /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:619:in</code>try_func'   from
    /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:894:in <code>block in have_func'
      from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:790:in</code>block in
    checking_for'     from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in
    <code>block (2 levels) in postpone'    from
    /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in</code>open'   from
    /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:284:in <code>block in postpone'
      from /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:254:in</code>open'    from
    /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:280:in <code>postpone'   from
    /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:789:in</code>checking_for'   from
    /opt/chef/embedded/lib/ruby/1.9.1/mkmf.rb:893:in <code>have_func'  from
    extconf.rb:45:in</code>'</p>
    
    <p>Gem files will remain installed in
    /var/www/project-name/releases/daf93f4783a7238e5a8198c1fd50e4e1de93f654/vendor/bundle/ruby/1.9.1/gems/mysql-2.9.1
    for inspection. Results logged to
    /var/www/project-name/releases/daf93f4783a7238e5a8198c1fd50e4e1de93f654/vendor/bundle/ruby/1.9.1/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
    An error occured while installing mysql (2.9.1), and Bundler cannot
    continue. Make sure that <code>gem install mysql -v '2.9.1'</code> succeeds
    before bundling.</p>
  </blockquote>
  
  <p>I am using RHEL 6. I also have a separate cookbook for mysql installation. I tried installing Mysql manually using the yum command. </p>
  
  <p>I tried  </p>
  
  <blockquote>
    <p>yum install mysql-devel and then run the gem install mysql</p>
  </blockquote>
  
  <p>still not working. Can anyone help me out.</p>
  
  <p>Thanks </p>