2011-07-20 14 views
11

मैं पिछले समूह से एक हाथ से अधिक पैकेज से निर्देशों का पालन कर रहा हूं। मैं रेल या mysql2 के बारे में बहुत कुछ नहीं जानता। मैं विंडोज़ पर हूं।रेक mysql2 "अज्ञात डेटाबेस" त्रुटि

जब मैं कार्य करें:

C:\jcccf-goslowserver-e30bf00>rake db:migrate RAILS_ENV=production 
(in C:/jcccf-goslowserver-e30bf00) 
rake aborted! 
Unknown database 'goslow_production' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/mysql2/client.r 
b:37:in `connect' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/mysql2/client.r 
b:37:in `initialize' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/active_record/c 
onnection_adapters/mysql2_adapter.rb:14:in `new' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6-x86-mingw32/lib/active_record/c 
onnection_adapters/mysql2_adapter.rb:14:in `mysql2_connection' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connect 
ion_adapters/abstract/connection_pool.rb:230:in `new_connection' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connect 
ion_adapters/abstract/connection_pool.rb:238:in `checkout_new_connection' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connect 
ion_adapters/abstract/connection_pool.rb:194:in `block (2 levels) in checkout' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connect 
ion_adapters/abstract/connection_pool.rb:190:in `loop' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connect 
ion_adapters/abstract/connection_pool.rb:190:in `block in checkout' 
C:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connect 
ion_adapters/abstract/connection_pool.rb:189:in `checkout' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connect 
ion_adapters/abstract/connection_pool.rb:96:in `connection' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connect 
ion_adapters/abstract/connection_pool.rb:318:in `retrieve_connection' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connect 
ion_adapters/abstract/connection_specification.rb:97:in `retrieve_connection' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connect 
ion_adapters/abstract/connection_specification.rb:89:in `connection' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/migrati 
on.rb:486:in `initialize' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/migrati 
on.rb:433:in `new' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/migrati 
on.rb:433:in `up' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/migrati 
on.rb:415:in `migrate' 
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/railtie 
s/databases.rake:142:in `block (2 levels) in <top (required)>' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `call' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `block in execute' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `each' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `execute' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain' 
C:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:581:in `invoke' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `each' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2013:in `top_level' 
C:/Ruby192/lib/ruby/1.9.1/rake.rb:1992:in `run' 
C:/Ruby192/bin/rake:31:in `<main>' 

C:\jcccf-goslowserver-e30bf00> 

मैं db उपयोग करने के लिए होने के बारे में पढ़ा है:

rake db:migrate RAILS_ENV=production 

यह आउटपुट है पहले बनाना लेकिन मुझे चिंता है कि मिटा दिया जाएगा हूँ हैंडओवर स्रोत कोड से पहले से क्या है। क्या यह समझ में नहीं आता है?

ये निर्देश दिए गए थे।

... 
3. Configure your MySQL settings in config/database.yml for "production" 
4. Open the console (cmd on Windows, Terminal on Mac/Linux) and cd to the GoSlow directory 
5. Type "rake db:migrate RAILS_ENV=production" and press enter. 
6. Type "rake bootstrap:all RAILS_ENV=production" and press enter. 

यहाँ मेरी database.yml फ़ाइल जो/database.yml जहां मैं इन टाइप कर रहा हूँ के सापेक्ष config में है (तो मैं मैं सिर्फ है सर्वर है, यह निर्दिष्ट नहीं करता रेल मान) आदेश देता है।

# MySQL. Versions 4.1 and 5.0 are recommended. 
# 
# Install the MySQL driver: 
# gem install 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: GoSlow_development 
    pool: 5 
    username: root 
    password: 
    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: GoSlow_test 
    pool: 5 
    username: root 
    password: 
    host: localhost 

production: 
    adapter: mysql2 
    encoding: utf8 
    reconnect: false 
    database: GoSlow_production 
    pool: 5 
    username: root 
    password: [MyPassword] 
    host: localhost 

कोई विचार क्यों नहीं काम करेगा?

उत्तर

4

शायद goslow_production डीबी

CREATE DATABASE goslow_production; 
57

बनाने आदेश

rake db:create 

त्रुटि से बचने के लिए पर्याप्त है चल रहा है।

+5

इस टिप्पणी को समाधान के रूप में चिह्नित किया जाना चाहिए IMHO –

+0

मैं @ एरियल कैबिब द्वारा टिप्पणी को दूसरी बार भेजता हूं। यह अधिक रेल विशिष्ट है। जितना संभव हो, हम डेटाबेस के भीतर ही निष्पादित नहीं करना चाहते हैं। –

संबंधित मुद्दे