Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninitialized constant Mysql2::Client::SECURE_CONNECTION #754

Closed
JohnMerlino1 opened this issue May 11, 2016 · 8 comments
Closed

uninitialized constant Mysql2::Client::SECURE_CONNECTION #754

JohnMerlino1 opened this issue May 11, 2016 · 8 comments

Comments

@JohnMerlino1
Copy link

I ran the following command on OSX 10.9.5:

brew update && brew upgrade && brew install imagemagick

Since that point, rails server and rails console raises errors.

Below is the first few lines of the error:

Users/donato/.rvm/gems/ruby-2.1.2@core/gems/mysql2-0.3.16/lib/mysql2/client.rb:12:in <class:Client>': uninitialized constant Mysql2::Client::SECURE_CONNECTION (NameError) from /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/mysql2-0.3.16/lib/mysql2/client.rb:2:inmodule:Mysql2'
from /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/mysql2-0.3.16/lib/mysql2/client.rb:1:in <top (required)>' from /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/mysql2-0.3.16/lib/mysql2.rb:10:inrequire'
from /Users/donato/.rvm/gems/ruby-2.1.2@core/gems/mysql2-0.3.16/lib/mysql2.rb:10:in `<top (required)>'

This is the mysql gem I am using (which was working fine until the brew update):
gem 'mysql2', '0.3.16'

How can I resolve this?

@jeremy
Copy link
Contributor

jeremy commented May 11, 2016

Duplicate of #603.

(When you did a brew update, you upgraded MySQL. Now upgrade the mysql2 library to support it.)

@JohnMerlino1
Copy link
Author

It seems the issue went away when upgrading the mysql2 gem to 0.3.18. When I updated it to latest version, I got a gemload error, and I assume the latest version is only compatible with Rails 5, whereas I am using Rails 4:

http://stackoverflow.com/questions/32457657/rails-4-gemloaderror-specified-mysql2-for-database-adapter-but-the-gem-i

@sodabrew
Copy link
Collaborator

sodabrew commented May 11, 2016 via email

@deepakmahakale
Copy link

Changing the version to ~> 0.3.21 fixed it for me

gem 'mysql2', '~> 0.3.21'

@kroim
Copy link

kroim commented Nov 1, 2019

gem 'mysql2', '~> 0.3.21'

This worked for me as well.
rails = 3.1.3, ruby = 1.9.3.p330

@Kulgar
Copy link

Kulgar commented May 12, 2020

And here too
rails = 3.2.12, ruby = 1.8.7 (yeah, very old project...)

@deepakmahakale
Copy link

@kroim @Kulgar
You gotta upgrade those apps 😄

@Kulgar
Copy link

Kulgar commented May 12, 2020

@deepakmahakale : yeah... I've just got that one into my hands, I even didn't know it was using a ruby that old until today... :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants