0

so I have a big problem i want to start on a project using rails 2.3.11 and ruby 1.8.7 firs i installed my sql

    gem install mysql

then i run

    rake db:create

but i got an error

    Couldn't create database for {"adapter"=>"mysql", "database"=>"test_development", "encoding"=>"utf8", "reconnect"=>false, "username"=>"root", "pool"=>5, "host"=>"localhost", "password"=>nil}, charset: utf8, collation: utf8_unicode_ci (if you set the charset manually, make sure you have a matching collation)

after some search i fount a solution was given that to run these commands i uninstall mysql and run this lines

    gem install mysql -- --with-mysql-dir=/usr/local \ --with-mysql-config=/usr/local/bin/mysql_config

but i got another error

    ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.

    /home/asnad/.rvm/rubies/ruby-1.8.7-p370/bin/ruby extconf.rb --with-mysql-dir=/usr/local  --with-mysql-config=/usr/local/bin/mysql_config
    extconf.rb:5: command not found: /usr/local/bin/mysql_config --cflags

    *** 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/asnad/.rvm/rubies/ruby-1.8.7-p370/bin/ruby
--with-mysql-config

i am trying for last two days please help me out before i brake my laptop thanks in advance.

Asnad Atta
  • 3,855
  • 1
  • 32
  • 49
  • possible duplicate of [MySQL Install: ERROR: Failed to build gem native extension](http://stackoverflow.com/questions/2167598/mysql-install-error-failed-to-build-gem-native-extension) – lucapette Jan 13 '13 at 12:11

2 Answers2

0

Try to use mysql2 gem .
If you’re planning on using the mysql2 gem for your application then you’ll want to install the libmysqlclient-dev package before you do that. For more detail: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

Ganesh Kunwar
  • 2,643
  • 2
  • 20
  • 36
0

I have solved the problem by

gem uninstall mysql
export PATH=$PATH:/usr/local/mysql/bin
sudo gem install mysql
Asnad Atta
  • 3,855
  • 1
  • 32
  • 49