Test Test
Test Test

Reputation: 2899

Mysql gem and Rails3

I am trying to install in my Gemfile the mysql gem. I type down this:

group :development, :test do

  #gem 'sqlite3-ruby', :require => 'sqlite3'

  #using mysql gem
  gem 'mysql', '2.8.1'

end

I run bundle install and everything runs ok. Ok when I run "rake db:reset" i get this:

Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.)

Tasks: TOP => db:drop => db:load_config
(See full trace by running task with --trace)

Now why would it even refer to sqlite3 since I am using mysql?

Upvotes: 1

Views: 3330

Answers (2)

Berggeit
Berggeit

Reputation: 253

I would advise you to use the mysql2 gem, rather than the mysql one (see: What the difference between mysql and mysql2 gem)

Also you need to change the "config/database.yml" file, probably it now looks like this:

development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

Which means that Rails tries to use sqlite3 rather than mysql for your database. There's a section in the Rails guides on how to change this for MySQL: http://guides.rubyonrails.org/getting_started.html#configuring-a-database

Upvotes: 2

Prashanth
Prashanth

Reputation: 1398

it looks like you created a rails app without specifying that you were going to use MySql database. Just a thought...

Did you run

rails new APP_NAME -d mysql -- This will create the app configured to use MySQL

or

rails new APP_NAME -- This will create the app configured to use SQLLite3

Upvotes: 0

Related Questions