Saturday, April 18, 2009

rake task db:create failing with charset error

Another bottleneck to start with, hopefully solved.

Started with ruby-netbeans on linux, generated the rails application with the help of IDE. It generate database.yml file for me. So without taking any pains I just chenged database credentials and database name and fired rake command rake db:create.

It gave error "charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a matching collation)" , hmmm seems some wrong input values.

generaed database.yml was (with some manual input values)

development:
adapter: mysql
encoding: utf8
database: Pets_development
username: root
password:
host: localhost

I changed the above settings to

development:
adapter: mysql
database: Pets_development
encoding: utf8
username: root
password:
socket: /var/lib/mysql/mysql.sock
host: 127.0.0.1


it worked, \o/

what seemed to be some encoding issue turned out to be incomplete details provided.

Hope helps someone......

Wednesday, April 15, 2009

Mysql Gem On Linux

Installing mysql gem on linux turned out to be herculean task. I thought it would be easy as the way rails gem gets installed without any hassles.

Piece of cake gem install mysql.
But this gave out error complaining about some libraries and headers missing.

I am not an expert on linux but found difficult to provide right libraries and finding them all. I downloaded the source code of mysql had it configured and then make.

I had source in /home/leo/work/mysql-5.0.77

After make I gave the gem command as :

gem install mysql -- --with-mysql-lib=/home/leo/work/mysql-5.0.77/libmysql/.libs/ --with-mysql-include=/home/leo/work/mysql-5.0.77/include/

Voila no errors and it worked like a charm.

I have opensuse 10.3 and mysql I selected while installing it.

Was tricky for rails developer like me trying things on linux, mostly did work on M$.