Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1102431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:11:08+00:00 2026-05-17T01:11:08+00:00

I am trying to install the mysql2 gem via the Bundler, but it keeps

  • 0

I am trying to install the mysql2 gem via the Bundler, but it keeps dying with the following error:

** executing command
/home/cc_rails/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/installer.rb:483:in 'rescue in block in build_extensions': 
ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/home/cc_rails/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
checking for rb_thread_blocking_region()... yes
checking for mysql.h... no
checking for mysql/mysql.h... no

-----
mysql.h is missing.  please check your installation of mysql and try again.
-----

*** 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=/home/cc_rails/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
--with-mysql-config
Gem files will remain installed for inspection.

Most things I found via Googling recommended passing the --with-mysql-config parameter to fix it. So, based on:

$ which mysql_config
/usr/bin/mysql_config

I added the following to the Bundler’s config:

$ bundle config build.mysql2 --with-mysql-config='/usr/bin/mysql_config'

However, still no luck — same crash as above.

Since it’s dying with the error mysql.h is missing, I checked for that, and it’s allegedly around, just can’t be found by the Bundler.

$ find / -name mysql.h
/usr/include/mysql5/mysql/mysql.h

Any thoughts?

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:11:08+00:00Added an answer on May 17, 2026 at 1:11 am

    Answer was similar to the one Wrikken posted — here’s what I did to fix it for the sake of future readers.

    (This is for RHEL 5.5 — similar but different commands apply for Ubuntu/Debian/etc.)

    Doing sudo yum list installed will print out all installed packages on your machine (note: yum on RHEL requires you add a Red Hat Network repository [I use EPEL], and run it via sudo).

    I had mysql and mysql-server, which explained why MySQL worked fine for every pre-existing app, but no mysql-devel, which is necessary to fix that mysql.h is missing error and similar other build errors.

    Long story short, after a mysqldump -u root -ppassword --all-databases > full-dump.sql for safety, it was fixed with a simple

    sudo yum install mysql-devel
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to do gem install of mysql2 but it looks like it
Trying to install mysql2 gem on ruby 1.9.2 and I get this error: Installing
I'm trying to install the spree_wholesale gem but receiving an error when I start
Getting a 'marshal data too short' error when trying to install the mysql gem
Trying to install mysql-python. Got following error. Got mysql and pythond already installed. Any
I am trying to install mysql2 gem in my windows machine and I get
I am trying to install mysql gem, version: 2.7 though it gives an error:
I'm trying to install the mysql2 gem with Rails 3.2.3 and it's failing: ★
I'm trying to install: gem twitter-bootstrap-rails, :group => :assets But when I use bundle
I'm trying to install acts_as_ferret in windows7.But am getting an error Using acts-as-taggable-on (2.1.1)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.