Mysql2 :: Client :: SECURE_CONNECTION uninitialized constant

I cannot start a Rails project due to an error that occurred in mysql2

This post did not help me: rake aborted! uninitialized Mysql2 constant

It also works great on the computers of my colleagues, so the problem with the project itself is excluded.

Here is the console output:

$ rails s
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'mysql2'. (Bundler::GemRequireError)
Gem Load Error is: uninitialized constant Mysql2::Client::SECURE_CONNECTION
Backtrace for gem load error is:
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/mysql2-0.3.14/lib/mysql2/client.rb:12:in `<class:Client>'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/mysql2-0.3.14/lib/mysql2/client.rb:2:in `<module:Mysql2>'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/mysql2-0.3.14/lib/mysql2/client.rb:1:in `<top (required)>'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/mysql2-0.3.14/lib/mysql2.rb:10:in `require'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/mysql2-0.3.14/lib/mysql2.rb:10:in `<top (required)>'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `require'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
/home/duke/RubymineProjects/*******/*******/config/application.rb:7:in `<top (required)>'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.15/lib/rails/commands.rb:53:in `require'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.15/lib/rails/commands.rb:53:in `block in <top (required)>'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.15/lib/rails/commands.rb:50:in `tap'
/home/duke/.rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.15/lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
Bundler Error Backtrace:
        from /home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler/runtime.rb:90:in `block (2 levels) in require'
        from /home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
        from /home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
        from /home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
        from /home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
        from /home/duke/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
        from /home/duke/RubymineProjects/********/********/config/application.rb:7:in `<top (required)>'
        from /home/duke/.rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.15/lib/rails/commands.rb:53:in `require'
        from /home/duke/.rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.15/lib/rails/commands.rb:53:in `block in <top (required)>'
        from /home/duke/.rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.15/lib/rails/commands.rb:50:in `tap'
        from /home/duke/.rvm/gems/ruby-2.0.0-p648/gems/railties-3.2.15/lib/rails/commands.rb:50:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

I tried all the tips from GitHub issues, but that didn't help.

  • I tried Ruby 2.0.0, 2.1.8, 2.2.x
  • My OS is Ubuntu 16.04
  • MySQL 5.6.16
  • ruby-mysqland libmysqlclient-devinstalled
+4
source share
1 answer

I had to upgrade mysql2to0.3.21

+11
source

Source: https://habr.com/ru/post/1663206/


All Articles