所以我試圖爲.yml文件中建議的我的rails生產環境數據庫設置一個環境變量。在我的.bash_profile我導出這樣的:rails database_url轉義mysql2 url passwod
export DATABASE_URL=mysql2://<username>:<password>@localhost/<database>
我去我的網站,我得到「ActiveRecord::AdapterNotSpecified
」的錯誤。
我能想到的唯一的事情就是我的密碼以@符號結尾,這會使得url有@@,並且在密碼結束和主機開始的地方變得困惑。
而且這個程序是在Hostmonster的託管是否有幫助
的database.yml:
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: <username>
password: <password>
database: <database>
development:
<<: *default
database: <database>
# 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:
<<: *default
database: <database>
# Avoid production credentials in the repository,
# instead read the configuration from the environment.
#
# Example:
# mysql2://myuser:[email protected]/somedatabase
#
production:
url: <%= ENV["DATABASE_URL"] %>
你的'config/database.yml'文件是什麼樣的? – tadman
database.yml added –