2012-01-16 65 views
1

運行RoR項目時出現問題。我得到這個錯誤,而運行它「Mysql2 ::錯誤 未知的數據庫'simple_cms_development'' 我不知道該怎麼做這個問題,以及如何解決它。任何人都可以幫我。在此先感謝有問題在rails上運行ruby項目

這裏是BT database.yml文件

# MySQL. Versions 4.1 and 5.0 are recommended. 
# 
# Install the MYSQL driver 
# gem install mysql2 
# 
# Ensure the MySQL gem is defined in your Gemfile 
# gem 'mysql2' 
# 
# And be sure to use new-style password hashing: 
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html 
development: 
    adapter: mysql2 
    encoding: utf8 
    reconnect: false 
    database: simple_cms_development 
    pool: 5 
    username: root 
    password: "123456" 
    host: localhost 

# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
    adapter: mysql2 
    encoding: utf8 
    reconnect: false 
    database: simple_cms_test 
    pool: 5 
    username: root 
    password: 
    host: localhost 

production: 
    adapter: mysql2 
    encoding: utf8 
    reconnect: false 
    database: simple_cms_production 
    pool: 5 
    username: root 
    password: 
    host: localhost 

我怎樣才能解決這個問題?

回答

3

是在MySQL創建的數據庫?如果不是,您可以嘗試運行rake db:create嘗試使用導軌爲您創建。

4

未知數據庫表示數據庫simple_cms_development尚不存在。如果用戶root已經存在密碼123456,則可以運行rake db:create,然後運行rake db:migrate

這些命令從命令行運行內側突出的軌的目錄