我刚刚用MySql创建了一个新的Rails 4应用程序,如下所示:
rails new mysqltest -d mysql并使用正确的凭据修改database.yml。
我生成了一个contoller示例,并更新了根路由的路由。
当我开始在生产中使用WEBrick时,
rails s -e production这个网站很好用。我看到索引页了。
当我开始使用没有3000端口的乘客时,我会看到以下错误:
database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)Passsenger正在生产环境中运行。
我的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
database: sample
pool: 5
username: sample
password: sample
socket: /var/run/mysqld/mysqld.sock
# 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
database: sample
pool: 5
username: sample
password: sample
socket: /var/run/mysqld/mysqld.sock
production:
adapter: mysql2
encoding: utf8
database: sample
pool: 5
username: sample
password: sample
socket: /var/run/mysqld/mysqld.sock发布于 2013-10-22 11:02:17
我在database.yml文件和apache文件中使用的情况不同。
两者应该是一样的。例如:production。
在apache中,我给出了Production。在将其更改为production之后,它起了作用。
源- https://groups.google.com/forum/#!topic/phusion-passenger/Kr-R0gSw6i8
发布于 2013-09-27 14:45:25
您创建本地生产数据库了吗?
rake db:create:all
RAILS_ENV=production bundle exec rake db:migrate是否正确地设置了database.yml文件以使用生产数据库?
你的创业板文件中有mysql吗?
常见的问题。
https://stackoverflow.com/questions/19053331
复制相似问题