Home > Rails > Ruby on Rails – MySQL configuration

Ruby on Rails – MySQL configuration

In recent days I’ve started working with Rails. I have everything installed within a few minutes and created a Rails-App, exactly as in home page of Rails was written.

Exciting!

I made a small application that makes all the CRUD with Ajax. I’ll write in my next post about this.

But first I want to say about MySQL configuration in Rails. It is really as simple as it was told in home page of Rails but on Windows, I get an error message. I’ve been looking for the solution for a long time.

Here again, how to make MySQL configuration in Rails on Windows and the solution of possible errors;

  1. gem install mysql
  2. in the Gemfile add mysql ( gem ‘mysql’ )
  3. Verify your config/database.yml file (adapter, passwords)
# MySQL version 5.1
#   gem install mysql
#
development:
  adapter: mysql
  database: customer
  host: localhost
  username: root
  password: passwd
  port: 3306
  encoding: utf8

and finished. If you get the following error message, download MySQL client library (libmySQL.dll) and copy it to your Rubybin folder.

Error:

$ rake db:migrate
rake aborted!
Mysql::Error: query: not connected: SHOW TABLES

Tasks: TOP => db:migrate
(See full trace by running task with –trace)

 

Advertisements
Categories: Rails Tags: , , , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: