2011-06-01 68 views
0

我试图建立一个MySQL数据库,但我收到此错误信息:Rails的:耙分贝:创建MySQL错误

 
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) 

这个任何援助? (上http://guides.rubyonrails.org/getting_started.html以下方向)

编辑:::

如何使用MySQL作为我的数据库,而不是SQLite的?在gemfile中,它明确指出:gem 'sqlite' ...我是否需要用类似gem mysql的东西来替换那条线?

回答

2

这是一个已知问题。请参阅:Rails - rake db:create error

但请注意,Rake 0.9.1已被释放,据称可以修复事情。所以,第一次尝试升级耙:

gem update rake 

并更新包:

bundle update rake 
0

您进行修改,是的,用你必须先安装并在系统中配置的MySQL的MySQL。然后在你的Gemfile,删除“宝石源码”,取而代之的是:

gem 'mysql' 

然后,在你的config/database.yml中,将其设置类似于:

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

执行相同的测试和生产。