Anand Joshi
Anand Joshi

Reputation: 454

rake db:migrate not working with Mysql adaptor ( windows 7 )

I am an experienced PHP programmer who is trying his hand on "Ruby on Rails", I have windows 7 as my operating system , I have installed ruby (1.9.3p125), rails (3.2.1) and gem (1.8.16), rake (0.9.2.2).

I am following the documentation on rails site to work on a demo app .

I created new project using "rails new demoApp". then inside the project I created a scaffold and tried

rake db:create

this created a database with no tables in it

Then I tried to migrate my db using

rake db:migrate

here is where my prompt freezes and does nothing , i mean according to my assumption it should have created tables of my project along with an additional table named "schema_migrations" in mysql but nothing happens.can anybody tell me what am I doing wrong ?

I googled for the log I received after using trace command the log says

Rake Aborted !!
Mysql::Error: query: not connected: SHOW TABLES LIKE 'schema_migrations'

i tried

rails dbconsole

it connects easily to the mysql prompt so there is no connection issue I dont know what is happening can anyone tell me where am I going wrong ?

I hope I am clear about my question.

Thanks

Upvotes: 1

Views: 1129

Answers (1)

shicholas
shicholas

Reputation: 6153

Have you installed the MySql gem? https://rubygems.org/gems/mysql

If not, add this to your Gemfile

gem 'mysql'

This gem is important because it sets your database up with Active Record, the ORM for Rails.

Upvotes: 1

Related Questions