August 16, 2009

libmysql.dll error with rails 2.2.2 and mysql gem

I recently had a situation when my system was formatted, i had to install rails with MySql .
so i started with installation of ruby as always, got all gems with it, downloaded the
MySql gem as they have removed the bundled gem of MySql with rails 2.2.2.

Now when i run gem install MySql-1.7.3 mswin32, i used to get an error saying cannot install Rdoc as # character found on line 71.

agreed i don't need Rdoc, so i thought may be the gem is successfully installed, but to my surprises, i saw the gem has [extconf.rb] file and no dll found in bundled installation.

after 29 hrs of struggle and some good experiences in past i was able to recognize that i had to add the [libmysql.dll] file from MySql bin folder, to this place where the gem is installed.

i figured this out and got my problems resolved.

now i have certain questions to David,
I agree mysql is moving out of the open source community so may be he removed the gem from rails bundled resource, agreed but why there exists no proper documentation which can guide the naive user with this change.
Neither the guys who developed MySql adapter have taken care of copying the [libmysql.dll] file from
MySql root folder to gem installation folder.

I also searched the internet for some help, but I was not sure of the posts telling me to do lot of re-installations and get this issue cured.

so expect with rails being so popular and dynamic, how hard it would be to find the mysql installed on system and copy the dll to required location.

I don't know if this knocks the right doors, least it can help may developers like me who are stuck with installation process pose them right way.

so guys if anyone faces a similar problem then please copy your [libmysql.dll] file from
MySql root location to gems/mysql/lib/ folder... restart system and you are set to go :-)

still facing native issues contact me :-

Recently one of friend had one more problem, after resolving the issue
Problem:-  Mysql::Error: query: not connected: SELECT version FROM schema_migrations

Get the libmysql.dll from the source above, and replace the dll copied in ruby/bin.