AndrejKostov
AndrejKostov

Reputation: 31

Why I cannot do anything on new Rails App?(says mysql gem missing, but I am using default sqlite3)

I have been getting this Error when trying to do anything after starting the server in Rails:

Puma caught this error: 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)
 .rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.7/lib/bundler/rubygems_integration.rb:334:in `block (2 levels) in replace_gem'
    .....

However I am not using mysql adapter in the database.yml file, I have installed rails app with default database settings.

Does it have something to do with the previous application I was working on, we were using docker and mysql2 there.

Gemfile:

ruby '2.6.5'

gem 'rails', '~> 6.0.3', '>= 6.0.3.4'
gem 'sqlite3', '~> 1.4'
gem 'puma', '~> 4.1'
gem 'sass-rails', '>= 6'
gem 'webpacker', '~> 4.0'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.7'
gem 'bootsnap', '>= 1.4.2', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '~> 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Upvotes: 0

Views: 150

Answers (1)

AndrejKostov
AndrejKostov

Reputation: 31

I had DATABASE_URL env variable set as mysql2 for the last application I was working on, so when i created the new App, rails set my default database to that, further info on the link below.

Found answer here.

Upvotes: 2

Related Questions