【问题标题】:Sqlite3 on development and mysql2 on productionSqlite3 用于开发,mysql2 用于生产
【发布时间】:2013-07-22 19:21:22
【问题描述】:

我在开发中使用 sqlite3 构建了一个 rails 应用程序。现在我想使用 mysql2 部署到机架空间,我想知道我需要哪些更改。我不想将任何数据从开发环境转移到生产环境。我的 database.yml 文件如下所示:

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# 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: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

你能告诉我我需要在这个文件中进行哪些更改以及我还需要做什么吗?

【问题讨论】:

标签: mysql ruby-on-rails production-environment


【解决方案1】:

你会希望你的生产数据库看起来像这样:

production:
  adapter: mysql2
  encoding: utf8
  database: name-of-your-mysql2-database-here
  pool: 5
  username: root
  password: your_password

【讨论】:

  • 非常感谢您的回复。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-07-07
  • 1970-01-01
  • 2011-01-19
  • 2015-10-27
  • 1970-01-01
相关资源
最近更新 更多