Skip to main content
Redmine reads database connection settings from config/database.yml. Copy the example file before editing:
cp config/database.yml.example config/database.yml
Use 2-space indentation in this file. Tabs are not valid YAML.

Configuration examples

config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "your_password"
  encoding: utf8mb4
  variables:
    transaction_isolation: "READ-COMMITTED"
You can also use the trilogy adapter for MySQL-compatible servers:
config/database.yml
production:
  adapter: trilogy
  database: redmine
  host: localhost
  username: redmine
  password: "your_password"
  encoding: utf8mb4
  variables:
    transaction_isolation: "READ-COMMITTED"
Redmine 5.1.1 and later require transaction_isolation: "READ-COMMITTED" when using MySQL. Without this setting, you may encounter concurrency-related errors. See the MySQL configuration guide for server-level configuration instructions.

Multiple environments

config/database.yml supports separate blocks for production, development, and test environments. Only the production block is used in production deployments:
config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "your_password"
  encoding: utf8mb4
  variables:
    transaction_isolation: "READ-COMMITTED"

development:
  adapter: mysql2
  database: redmine_development
  host: localhost
  username: redmine
  password: "your_password"
  encoding: utf8mb4
  variables:
    transaction_isolation: "READ-COMMITTED"

test:
  adapter: mysql2
  database: redmine_test
  host: localhost
  username: redmine
  password: "your_password"
  encoding: utf8mb4
  variables:
    transaction_isolation: "READ-COMMITTED"
The test database is erased and recreated when running the test suite. Never point it at the same database as development or production.

Connection pooling

Rails manages a connection pool for each environment. You can configure the pool size by adding a pool key:
config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "your_password"
  encoding: utf8mb4
  pool: 10
  variables:
    transaction_isolation: "READ-COMMITTED"
The default pool size is 5. Increase it if you run a multi-threaded application server with many concurrent requests.

Applying the configuration

After editing config/database.yml, run the database migrations to create the schema:
bundle exec rake db:migrate RAILS_ENV="production"
If you change the adapter (e.g. switching from MySQL to PostgreSQL), re-run bundle install so that the correct adapter gem is installed:
bundle install --without development test