Feeds:
Posts
Comments

Archive for January 26th, 2011

Greetings!

After googling for  a day, i solved the error which i faced while installing gem mysql2

Install mysql2 gem

[root@localhost ~]# gem install mysql2

I faced the following error

Error

Building native extensions.  This could take a while…
ERROR:  Error installing mysql2:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
mkmf.rb can’t find header files for ruby at /usr/lib/ruby/ruby.h

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql2-0.2.6 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql2-0.2.6/ext/mysql2/gem_make.out

Solution

After following this link http://stackoverflow.com/questions/2167598/mysql-install-error-failed-to-build-gem-native-extension

i came to know that i need to install

a. Development headers of ruby

b. Development headers of mysql

Install development headers of ruby ( ruby-devel ) on fedora 14

[root@localhost ~]# yum install ruby-devel

Install development headers of mysql (mysql-devel) on fedora 14

[root@localhost ~]# rpm -Uvh http://rpms.famillecollet.com/remi-release-14.rpm

[root@localhost ~]# yum –enablerepo=remi install mysql-devel

Now , Install gem mysql2

[root@localhost ~]# gem install mysql2
Building native extensions.  This could take a while…
Successfully installed mysql2-0.2.6
1 gem installed
Installing ri documentation for mysql2-0.2.6…

mysql2 gem is installed now

Now im able to use mysql db in rails application 🙂

Advertisements

Read Full Post »

Greetings!

By yesterday i installed Fedora 14

So, today i started to install the following software  to run rails application on Fedora 14

a. Git

b. Ruby

c. Rubygems

d. Rails 3

e. VLC Media Player

f. Installing and Configuring MySQL Db

Installing Git

The steps to install git on fedora 14 are here  http://ow.ly/3JZBo

Installing Ruby

Guide to install ruby are here http://ow.ly/3JZGQ

Installing Rubygems and Rails3

Check out from this link http://ow.ly/3JZNe

Installing VLC

Follow the link http://ow.ly/3JZRR to install it

Installing and configuring MySQL on fedora 14

Install remi repository

rpm -Uvh http://rpms.famillecollet.com/remi-release-14.rpm

Install MySQL 

yum –enablerepo=remi install mysql mysql-server

Start MySQL server

/etc/init.d/mysqld start

Start MySQL secure installation

mysql_secure_installation

The above command will ask us to set a root password. But in the line

Enter current password for root (enter for none):

when i entered nothing i received the following error

ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)

Then i googled to solve it

Steps

/etc/init.d/mysqld stop

mysqld_safe –skip-grant-tables &

mysql -u root

mysql> use mysql;

mysql> update user set password=PASSWORD(“newpassword”) where User=’root’;

mysql> flush privileges;

mysql> quit

/etc/init.d/mysqld stop

/etc/init.d/mysqld start

mysql -u root -p

Now im able to login to mysql prompt with the password set above using update command 🙂

Then  i tried to install mysql2 gem to connect rails application with mysql db

But when i gave the command

[root@localhost ~]# gem install mysql2

it resulted in the following error

Building native extensions.  This could take a while…
ERROR:  Error installing mysql2:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
mkmf.rb can’t find header files for ruby at /usr/lib/ruby/ruby.h

I spent more than half a day in fixing the error,  but im unable to fix it

Hope to solve it soon

Read Full Post »