LoadError: Could not load 'active_record/connection_adapters/mysql2_adapter'

1,692 views
Skip to first unread message

tom

unread,
Jun 26, 2017, 10:57:36 AM6/26/17
to Ruby on Rails: Talk, capis...@googlegroups.com
HI, im getting the error below during a cap deploy. i can run production console successfully on the server.
any ideas?
thx



EBUG [04b3530e] Command: cd /rorapps/myapp/production/myapp_com/releases/20170626144940 && ~/.rvm/bin/rvm ruby-2.3.1@myapp_gemset do bundle install --path /rorapps/myapp/production/myapp_co                    m/shared/bundle --without development test --deployment --quiet
  INFO [04b3530e] Finished in 11.265 seconds with exit status 0 (successful).
 DEBUG [c63173da] Running if test ! -d /rorapps/myapp/production/myapp_com/releases/20170626144940; then echo "Directory does not exist '/rorapps/myapp/production/myapp_com/releases/2017062614                    4940'" 1>&2; false; fi as railsuser@myip
 DEBUG [c63173da] Command: if test ! -d /rorapps/myapp/production/myapp_com/releases/20170626144940; then echo "Directory does not exist '/rorapps/myapp/production/myapp_com/releases/201706261                    44940'" 1>&2; false; fi
 DEBUG [c63173da] Finished in 0.029 seconds with exit status 0 (successful).
  INFO [24759d1b] Running ~/.rvm/bin/rvm ruby-2.3.1@myapp_gemset do bundle exec rake assets:precompile as railsuser@myip
 DEBUG [24759d1b] Command: cd /rorapps/myapp/production/myapp_com/releases/20170626144940 && ( export RAILS_ENV="production" RAILS_GROUPS="" ; ~/.rvm/bin/rvm ruby-2.3.1@myapp_gemset do bundle e                    xec rake assets:precompile )
 DEBUG [24759d1b]       rake aborted!
 DEBUG [24759d1b]       LoadError: Could not load 'active_record/connection_adapters/mysql2_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than '                    mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.
 DEBUG [24759d1b]       /rorapps/myapp/production/myapp_com/shared/bundle/ruby/2.3.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'

Colin Law

unread,
Jun 26, 2017, 11:25:11 AM6/26/17
to Ruby on Rails: Talk
On 26 June 2017 at 15:56, tom <toma...@gmail.com> wrote:
> HI, im getting the error below during a cap deploy. i can run production
> console successfully on the server.
> any ideas?
> thx
> ...
> DEBUG [24759d1b] rake aborted!
> DEBUG [24759d1b] LoadError: Could not load
> 'active_record/connection_adapters/mysql2_adapter'. Make sure that the
> adapter in config/database.yml is valid. If you use an adapter other than '
> mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to
> the Gemfile.

Have you tried running assets:precompile locally, in production environment?

What have you got in database.yml? Also post Gemfile please.

Colin

tom

unread,
Jun 26, 2017, 11:42:33 AM6/26/17
to Ruby on Rails: Talk
i did change from mysql to mariadb (debian 7 upgrade to 8).
just did this too:
gem install mysql2 -- --with-mysql-config=/usr/bin/mariadb_config
but no go....


db.yml
# MySQL.  Versions 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:
#
default: &default
  adapter: mysql2
  encoding: utf8
  pool: 5
  username: wahwah
  password: wahwah
  socket: /var/run/mysqld/mysqld.sock

development:
  <<: *default
  database: myapp_dev

# 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:
  <<: *default
  database: myapp_test

staging:
  <<: *default
  database: myapp_staging
  host: localhost
  username: wahwah
  password: wahwah


production:
  <<: *default
  host: localhost
  database: myapp_production
  username: wahwah
  password: wahwah
=====================
gem file:

gem 'rails', '4.2.0'
gem 'sass-rails' #, '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'mini_magick'
gem 'bundler'
gem 'will_paginate', '~> 3.1.0'
gem 'will_paginate-bootstrap'
gem 'sinatra', require: false
gem 'slim'
gem 'jquery-rails'
gem 'meta-tags'
gem 'ransack', github: 'activerecord-hackery/ransack'
gem 'omniauth'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem 'omniauth-linkedin'
gem "jquery-ui-rails"
gem 'execjs'
gem 'therubyracer'
gem 'mysql2'# , '~> 0.3.18'
gem 'sidekiq'
gem 'social-share-button'
gem 'simple_form'
gem 'mechanize'
gem "actionpack-page_caching"
gem 'rails-observers'
gem 'nokogiri'
gem 'ckeditor'
gem 'rails-gallery'
gem 'thredded', '~> 0.9.2'
gem 'anemone'
gem 'lol_dba'
gem 'bullet', group: 'development'
gem 'actionpack-action_caching'
#gem 'classifieds', path: 'engines/classifieds'

#gem 'thredded', '~> 0.9.2'
#gem 'country_state_select' , '3.0.0'
#gem 'yui-compressor', '~> 0.12.0'
#gem 'pry'
#gem 'exception_handler' #, '~> 0.5.0' #-> Gemfile
gem "koala", "~> 2.2"
gem 'whenever', require: false
gem 'bootstrap3_autocomplete_input'
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
gem 'font-awesome-rails'
gem 'figaro'
gem 'sitemap_generator'
gem 'momentjs-rails', '>= 2.9.0'
gem 'bootstrap3-datetimepicker-rails', '~> 4.17.37'
gem 'paper_trail'
gem "braintree"
gem 'gon'
gem 'auto_html','~>1.6.4'
#gem 'capistrano' #, '~> 3.4.0'

gem 'capistrano-bundler' #, '~> 1.1.2'
gem 'capistrano-rvm'
gem 'capistrano-passenger'
#gem 'rvm1-capistrano3', require: false
gem 'capistrano-sidekiq' #, group: :development
gem "passenger"
#gem 'twitter-bootstrap-rails', :git => 'https://github.com/seyhunak/twitter-bootstrap-rails.git', :branch => 'master'
#gem 'simple_token_authentication'
gem 'twitter'
gem 'plivo'
gem 'acts-as-taggable-on'
gem 'groupdate'
gem "chartkick"
gem 'friendly_id', '~> 5.1.0' # Note: You MUST use 5.0.0 or greater for Rails 4.0+
gem 'devise'
gem 'devise_invitable'
gem 'carrierwave'
gem 'public_activity'
gem 'bootstrap-will_paginate'
gem 'acts_as_votable', '~> 0.10.0'
gem 'acts_as_commentable'
gem 'acts_as_follower'
gem 'counter_culture', '~> 0.1.33'
gem "mailboxer"
gem 'faker'
gem 'populator'
gem 'awesome_nested_set'
#gem 'country_state_select' # , '3.0.2'
gem 'city-state'
gem 'chosen-rails'
gem 'spring'
  gem 'better_errors'
  gem 'letter_opener'
  gem 'guard'
  gem 'guard-rspec', '~> 4.2.8'
  #gem 'rails_12factor'
#gem 'sprockets'
group :development do
gem 'capistrano-rails' #, '~> 1.1.0'
  gem 'capistrano-ssh-doctor', '~> 1.0'
end

gem 'devise-encryptable'
#gem 'devise-async' #send email



Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuKLNZnfcaapvc3ypdi6JfRwM1wPwZpXpLBhsqKB1Km6A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

tom

unread,
Jun 26, 2017, 11:43:06 AM6/26/17
to Ruby on Rails: Talk
pty true false doesnt make a difference...

Colin Law

unread,
Jun 26, 2017, 4:05:32 PM6/26/17
to Ruby on Rails: Talk
You didn't answer my other question, what happens if you run locally
RAILS_ENV=production bundle exec rake assets:precompile

Also I notice you have
gem 'mysql2'# , '~> 0.3.18'
Why have you commented out the version requirement? I think it may be
required for rails 4.2


Colin
>> email to rubyonrails-ta...@googlegroups.com.
>> To post to this group, send email to rubyonra...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMdO9X35wRGbK-HGbv-4oTA6NFwkx9RLXeUe%2BgJmKvsdWg%40mail.gmail.com.

tom

unread,
Jun 26, 2017, 4:40:58 PM6/26/17
to Ruby on Rails: Talk
bot commands succeed

i even can run
rails c production without issue...

clueless


>> email to rubyonrails-talk+unsubscribe@googlegroups.com.
>> To post to this group, send email to rubyonrails-talk@googlegroups.com.

>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuKLNZnfcaapvc3ypdi6JfRwM1wPwZpXpLBhsqKB1Km6A%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.

> To view this discussion on the web visit
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuoXHAqLPR%3DELffNp2DL5%3Dz638kEhRDX14pM6gSuH4Upw%40mail.gmail.com.

Colin Law

unread,
Jun 26, 2017, 4:47:26 PM6/26/17
to Ruby on Rails: Talk
On 26 June 2017 at 21:39, tom <toma...@gmail.com> wrote:
> bot commands succeed

Which both commands?

Colin
>> >> email to rubyonrails-ta...@googlegroups.com.
>> >> To post to this group, send email to rubyonra...@googlegroups.com.
>> >> To view this discussion on the web visit
>> >>
>> >> https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuKLNZnfcaapvc3ypdi6JfRwM1wPwZpXpLBhsqKB1Km6A%40mail.gmail.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Ruby on Rails: Talk" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to rubyonrails-ta...@googlegroups.com.
>> > To post to this group, send email to rubyonra...@googlegroups.com.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMdO9X35wRGbK-HGbv-4oTA6NFwkx9RLXeUe%2BgJmKvsdWg%40mail.gmail.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to rubyonrails-ta...@googlegroups.com.
>> To post to this group, send email to rubyonra...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMchT6_YLOM3adEeefxZ27x27KUtepApYo6HPSuQeJ8ZrA%40mail.gmail.com.

tom

unread,
Jun 26, 2017, 4:49:47 PM6/26/17
to Ruby on Rails: Talk
local:
precompiling assets locally - OK
reverting back to mysql verison:
gem 'mysql2' , '~> 0.3.20' 


server:
rails c production - OK



 

>> >> email to rubyonrails-talk+unsubscribe@googlegroups.com.
>> >> To post to this group, send email to rubyonrails-talk@googlegroups.com.

>> >> To view this discussion on the web visit
>> >>
>> >> https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuKLNZnfcaapvc3ypdi6JfRwM1wPwZpXpLBhsqKB1Km6A%40mail.gmail.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Ruby on Rails: Talk" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to rubyonrails-talk+unsubscribe@googlegroups.com.
>> > To post to this group, send email to rubyonrails-talk@googlegroups.com.

>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMdO9X35wRGbK-HGbv-4oTA6NFwkx9RLXeUe%2BgJmKvsdWg%40mail.gmail.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to rubyonrails-talk+unsubscribe@googlegroups.com.
>> To post to this group, send email to rubyonrails-talk@googlegroups.com.

>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuoXHAqLPR%3DELffNp2DL5%3Dz638kEhRDX14pM6gSuH4Upw%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.

> To view this discussion on the web visit
>
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuDLnmYRJ5Ki7ncjF%2BXeeAyw8GQoXHSgdh6%3DsPaM88NhQ%40mail.gmail.com.

Colin Law

unread,
Jun 26, 2017, 4:54:05 PM6/26/17
to Ruby on Rails: Talk
On 26 June 2017 at 21:49, tom <toma...@gmail.com> wrote:
> local:
> precompiling assets locally - OK
> reverting back to mysql verison:
> gem 'mysql2' , '~> 0.3.20'
>
>
> server:
> rails c production - OK

I am clueless too then, sorry. Hopefully someone else will have an idea.

Colin
>> >> >> email to rubyonrails-ta...@googlegroups.com.
>> >> >> To post to this group, send email to
>> >> >> rubyonra...@googlegroups.com.
>> >> >> To view this discussion on the web visit
>> >> >>
>> >> >>
>> >> >> https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuKLNZnfcaapvc3ypdi6JfRwM1wPwZpXpLBhsqKB1Km6A%40mail.gmail.com.
>> >> >> For more options, visit https://groups.google.com/d/optout.
>> >> >
>> >> >
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups
>> >> > "Ruby on Rails: Talk" group.
>> >> > To unsubscribe from this group and stop receiving emails from it,
>> >> > send
>> >> > an
>> >> > email to rubyonrails-ta...@googlegroups.com.
>> >> > To post to this group, send email to
>> >> > rubyonra...@googlegroups.com.
>> >> > To view this discussion on the web visit
>> >> >
>> >> >
>> >> > https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMdO9X35wRGbK-HGbv-4oTA6NFwkx9RLXeUe%2BgJmKvsdWg%40mail.gmail.com.
>> >> >
>> >> > For more options, visit https://groups.google.com/d/optout.
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "Ruby on Rails: Talk" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> >> an
>> >> email to rubyonrails-ta...@googlegroups.com.
>> >> To post to this group, send email to rubyonra...@googlegroups.com.
>> >> To view this discussion on the web visit
>> >>
>> >> https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuoXHAqLPR%3DELffNp2DL5%3Dz638kEhRDX14pM6gSuH4Upw%40mail.gmail.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Ruby on Rails: Talk" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to rubyonrails-ta...@googlegroups.com.
>> > To post to this group, send email to rubyonra...@googlegroups.com.
>> > To view this discussion on the web visit
>> >
>> > https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMchT6_YLOM3adEeefxZ27x27KUtepApYo6HPSuQeJ8ZrA%40mail.gmail.com.
>> >
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to rubyonrails-ta...@googlegroups.com.
>> To post to this group, send email to rubyonra...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMcSxw3ouK0XfDPCi7A07HEqjB4kaXa5LHSpJewY3k14pw%40mail.gmail.com.

go...@solutionize.in

unread,
Jun 27, 2017, 10:04:28 AM6/27/17
to Ruby on Rails: Talk, capis...@googlegroups.com
On the server, try:

cd /rorapps/myapp/production/myapp_com/current

~/.rvm/bin/rvm use 2.3.1@myapp_gemset

gem install mysql2 -- --with-mysql-config=/usr/bin/mariadb_config



tom

unread,
Jun 27, 2017, 10:21:05 AM6/27/17
to Ruby on Rails: Talk
i did that too, and reverted back; no go....

meanwhile i have trashed the image and recreated everything...

thx everyone


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/12d66222-86e3-4441-b2d7-54fe7c92d57b%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages