WHAT'S NEW?
Loading...

Mysql2 installation in ruby on rails window platform error


Many programmer today, are using open source framework like ruby on rails. Ruby is a object oriented programming language. While the rails is a framework.
Now to begin the installation we need the following:

  • Ruby
  • Rails
  • Git
  • Devkit
  • Webserver
  • Mysql and Mysql2 (database)
  • E txt (text editor)

I choose mysql and mysql2 as my database for ease of use and its free. Now to download the  following manually download the link from this link: http://rubyonrails.org/download. Or download the updated package and skip all the head aches and erros, http://www.rubyinside.com/rails-installer-ruby-and-rails-on-windows-in-a-single-install-4201.html
After installing the Ruby on Rails including the Git and the Devkit. We gonna need a database. Follow this link to download mysq version 5.1 http://dev.mysql.com/downloads/mysql/5.1.html.
Now here is the tricky thing. After installing mysql database go to directory folder and copy the libmysql.dll inside the bin folder.
After copying the libmysql.dll of the mysql database, go to the directory folder of Ruby. Inside it go to the bin.
  • Note:If you choose to download and install the stand alone package. You can locate the ruby folder inside the railsinstaller folder in “c:”.
After the pasting is done. Run the command prompt is window and type the following. “gem install mysql”
To check whether it is successfully installed, type “gem list” to view all the install plugins in gem.
Now we will install the mysql2, other say its quite complicated, however it can be install in one script.
Again, go to command prompt with ruby on rails in window and type the following or just copy paste it, gem install mysql2 -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.1\lib\opt" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.1\include"'
  • Note: That the following directory is base from my computer directory installation.
After the process, type in the “gem list” to check the mysql2. If exist, were done.

Credits to : Ritesh Kumar and lynda.com