我正在開發的Rails應用程序在我的本地計算機(MAC)上正常運行。當我把它上傳到服務器版本(CentOS 6.2的Linux,使用Rails 3.2.3和乘客安裝),並嘗試啓動應用程序(通過輸入網址到瀏覽器),我收到以下錯誤信息:Rails:錯誤:數據庫配置沒有指定適配器
Ruby (Rack) application could not be started There appears to be a database problem.
Your application's database configuration file might be written incorrectly. Please check it and fix any errors.
The database server may not be running. Please check whether it's running, and start it if it isn't.
Error message: database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified) Exception class: ActiveRecord::AdapterNotSpecified
請注意,當我運行rake db:create
和rake db:migrate
時,這兩個任務都運行正常,數據庫已正確創建和遷移。
以下是我的database.yml文件:
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: acme_development
pool: 5
username: root
password: ***********
socket: /tmp/mysql.sock
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: acme_test
pool: 5
username: root
password: *****************
socket: /tmp/mysql.sock
任何想法?
哪裏是生產配置? –
我把生產拿出來了。乘客是否承擔生產?我認爲開發是默認的,除非我另有指定。 –
我這麼認爲。但我從未使用Passenger。指定您的生產數據庫並執行'rake db:setup RAILS_ENV = production',然後查看它是否有效。 –