mysql error, in rails3

This is one of most common error, you will find when you start working with rails3. But the solution is really simple. Just change the gemname to mysql2 instead mysql in the Gemfile. By now we know, that Gemfile is like a repository of the gems we need for the application, somewhat like unpacking a gem, so that we do not need to install manually the huge list of gems in each environment and bite our nails if we miss something.

The entry in Gemfile is something like this,
gem 'mysql2'

from the command propmt, go to the directory where your app is, and execute the following command to install all the gems in gemfile
bundle install

That;s it your gem mysql2 has been installed.

Now you need to change the database.yml adapter from mysql to mysql2.

run rake db:create
and see your app up and running in http://localhost:3000 (ofcourse you need to start the server , if not started yet ;)
rails server
Happy Rails-ing :)


Popular Posts