Defect #42013
closed
Redmine fails to start with error: Unknown database adapter `"mysql2"` found in config/database.yml
Added by Daniel Drexlmaier 1 day ago.
Updated about 14 hours ago.
Description
I use Docker. I testet this with "redmine" and "redmine:5". Testet with 6.0.2 and an 5.1.5.
With 5.1.4 it works
Unknown database adapter `"mysql2"` found in config/database.yml, use Gemfile.local to load your own database gems
pm1.de1.dbe.academy | Your Gemfile lists the gem puma (>= 0) more than once.
pm1.de1.dbe.academy | You should probably keep only one of them.
pm1.de1.dbe.academy | Remove any duplicate entries and specify the gem only once.
pm1.de1.dbe.academy | While it's not a problem now, it could cause errors if you change the version of one of them later.
pm1.de1.dbe.academy | The Gemfile's dependencies are satisfied
pm1.de1.dbe.academy | Unknown database adapter `"mysql2"` found in config/database.yml, use Gemfile.local to load your own database gems
pm1.de1.dbe.academy | rake aborted!
pm1.de1.dbe.academy | LoadError: Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? mysql2 is not part of the bundle. Add it to your Gemfile. (LoadError)
Same here, workaround helped.
Daniel, thank you for the issue and links!
- Category changed from Database to Gems support
- Target version set to 5.1.6
The following patch fixes the issue.
I am setting the target version to 5.1.6.
diff --git a/Gemfile b/Gemfile
index 2f075c6c3..478084c20 100644
--- a/Gemfile
+++ b/Gemfile
@@ -67,11 +67,11 @@ if File.exist?(database_file)
adapters = database_config.scan(/^ *adapter: *(.*)/).flatten.uniq
if adapters.any?
adapters.each do |adapter|
case adapter.strip
- when 'mysql2'
+ when /mysql2/
gem 'mysql2', '~> 0.5.0'
gem "with_advisory_lock"
when /postgresql/
gem 'pg', '~> 1.5.3'
when /sqlite3/
- Related to Defect #41749: Warning during startup: "Unresolved or ambiguous specs during Gem::Specification.reset" added
I tested the patch from #note-4 on Redmine using docker-library/redmine and confirmed it works as expected. The patch in #note-4 seems to resolve the issue.
Specifically, I built the Docker image locally by modifying the Dockerfile in docker-library/redmine to target this branch and confirmed it works using the official compose.yml example.
- Subject changed from Unknown database adapter `"mysql2"` found in config/database.yml to Redmine fails to start with error: Unknown database adapter `"mysql2"` found in config/database.yml
- Status changed from New to Resolved
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the fix in r23408. Thank you for reporting this issue.
- Status changed from Resolved to Reopened
Merged the fix into the stable branches in r23409 and r23410.
- Status changed from Reopened to Closed
Also available in: Atom
PDF