-
Notifications
You must be signed in to change notification settings - Fork 550
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 (NameError) #603
Comments
The prebuilt mysql2 gem binaries do not include ruby 2.2 builds. Use either ruby 2.1 or build the gem locally.
|
@sodabrew I'm using RubyInstallers and did build with |
I downgraded to ruby 2.0.0 and no longer receive this error. Closing |
Please use mysql2 0.3.18 for more reliable windows builds.
|
Ok glad it's working now!
|
Quick brew bash rundown for those coming from SEO channel: $ brew tap homebrew/versions
$ brew update
$ brew uninstall mysql mysql2 # probs auto updated to 5.7
$ brew install mysql56 # 5.6 locked version
# copy in the launchctrl output
$ gem uninstall mysql mysql2 # uninstall legacy gems
$ bundle install # to install / rebuild new refs |
@tomfuertes mysql2 gem 0.3.17 and 0.2.24 and above support MySQL 5.7. Directing people to downgrade to MySQL 5.6 is not necessary. |
@tomfuertes 👍 Thanks bro. I'm stuck on 0.3.11 and this helped me to get my app running again after I reloaded my workstation. |
i occured this problems since i upgraded mysql57 ,s what should i do to solve it |
mac mysql 0.3.20 rails 3.2.16 |
Try gem uninstall MySQL then reinstall.
|
@ZouQiLin As I wrote above, you will need the mysql2 gem version 0.3.17 or higher to run with MySQL 5.7. |
@sodabrew i tried mysql2 0.3.20 but the problem continued |
+1 @ZouQiLin |
It's simply not possible. The code always defines SECURE_CONNECTION: https://github.com/brianmario/mysql2/blob/0.3.x/ext/mysql2/client.c#L1381-L1388 Perhaps you are installing a new copy of the mysql2 gem and still using the old copy? Is your project using a Gemfile or Gemfile.lock with a specific and older version of mysql2 specified? |
@sodabrew Thanks. Finding the right version of mysql2 was the key. "0.3.15" couldn't handle the new mysql I homebrew installed, and "0.4..." was too new for my rails 3.2 (I think). "0.3.17" is working. |
@Arcolye I was also having trouble with the versions and all, and I'm also using rails 3.2. Tried 0.3.15, and 0.3.20 but no luck. I read your comment about using 0.3.17 and it worked. Thanks! |
@kbleabres @sodabrew it's ok after I exec scripts as follows rm -rf vendor/bundle
bundle install |
@sodabrew 0.3.17 has done it, thanks! |
I am using rails 2.3.18 with mysql 0.3.17, 0.3.15. 0.3.20 on Mac Caption. with mysql 0.3.15 the error is=> Rails 2.3.18 application starting on http://0.0.0.0:8000 with mysql 0.3.17 and 0.3.20 the error isGem::SourceIndex#search called from /Users/AChittimilla/.rvm/gems/ruby-1.9.3-p551@webstore-admin/gems/rails-2.3.18/lib/rails/vendor_gem_source_index.rb:119. |
You must use mysql2 series 0.2.x with Rails 2.3.x. I believe that mysql2 version 0.2.24 contains the necessary change to work with MySQL 5.7. |
Thanks, changing to mysql2 gem to 0.2.24 worked !! |
Upgrading to |
MySQL 5.7 contains incompatible changes.
Checkout rails/rails#13247
|
Fixes "uninitialized constant Mysql2::Client::SECURE_CONNECTION". Related to brianmario/mysql2#603
I ran into this issue several times and found an easier fix which is quickly editing client.rb in the error message and changing line |
@paralaks The workaround for this was added to mysql2 more than two years ago. No action is required unless you're using an ancient version of the gem at this point. |
@sodabrew I am on an old version of the gem and I can not upgrade. |
@paralaks Here's the compatibility table for Rails and mysql2 versions: https://github.com/brianmario/mysql2/blob/master/README.md#compatibility To fix your problem you should upgrade your mysql2 gem version or downgrade MySQL. |
@Stefanovskyi-Oleksandr As I said earlier, upgrade is not possible for my project. Anyone in a similar situation can use my workaround. |
@paralaks Thank you very much!! I have the task to upgrade a old instance of gitlab (6.4.2) and after upgrading the OS this error occurred. This helped me to get gitlab back working again. |
Like @Arcolye the |
I'm trying to get my application running on a windows server but when running rails server I get the below error. I have installed MySQL and ran the bundle install.
The text was updated successfully, but these errors were encountered: