0

I am trying to setup a mysql database, but I am getting this error message:

rake db:create
(in /Users/yookd/Desktop/rails/blog)
WARNING: Global access to Rake DSL methods is deprecated.  Please Include
    ...  Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method Blog::Application#task called at /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'
db/test.sqlite3 already exists
rake aborted!
uninitialized constant Mysql2

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

Any assistance with this? (following directions on http://guides.rubyonrails.org/getting_started.html)

EDIT:::

How can I use mysql as my database as opposed to sqlite? In the gemfile, it explicitly states: gem 'sqlite'... do I need to replace that line with something like gem mysql?

rabid_zombie
  • 982
  • 2
  • 16
  • 32

2 Answers2

2

This is a known issue. See: Rails - rake db:create error

BUT note that Rake 0.9.1 has been released which supposedly fixes things. So first try upgrading rake with:

gem update rake

And update your bundle:

bundle update rake
Community
  • 1
  • 1
Jits
  • 9,647
  • 1
  • 34
  • 27
0

For your edit, yes, to use mysql you have to first have mysql installed and configured on your system. Then in your gemfile, remove 'gem sqlite' and replace it with:

gem 'mysql'

Then, in your config/database.yml, set it up something similar to:

development:
  adapter: mysql
  database: name_of_database
  pool: 5
  timeout: 5000
  host: localhost
  password: mysql_password

Do the same for test and production.

ardavis
  • 9,842
  • 12
  • 58
  • 112