Questions tagged [mysql2]

The Mysql2 gem is meant to serve the extremely common use-case of connecting, querying and iterating on results.

The mysql2 gem is an interface for accessing MySQL databases from Ruby. This gem is an incompatible improvement over the original mysql gem.

Links:

907 questions
11
votes
2 answers

Start webrick in port 80 (mysql2 gem issue)

I am trying to get my webrick serve in port 80. I tried: rails server -p 80 but get a access denied. I later understood that using port 1-1024 needs a root permission, so I tried this instead sudo rails server -p 80 However, now i get a mysql2…
Howard Huang
  • 355
  • 1
  • 4
  • 9
11
votes
2 answers

Failure to install old mysql2 gem

I am using Mac High Sierra. I am using Ruby 2.2.1 with RVM. I need to use mysql2 with this Ruby on Rails app. I do have mysql 5.7 installed. I do have xcode installed along with the command-line tools. I am simply trying to get this company app…
Alec Hayden
  • 191
  • 2
  • 12
11
votes
2 answers

Fixing this Error: NameError (uninitialized constant ActiveRecord::ConnectionAdapters::Mysql2Adapter::Column)

There are two apps. One of the apps is using rails 4.1.2. The other app is using rails 5.0.1. Here is how the rails 5 app works: it checks if the user is logged in: If the user is logged in: then the user should be able to proceed forward. …
Neil
  • 4,578
  • 14
  • 70
  • 155
11
votes
5 answers

Error "...cannot load such file -- mysql2/2.0/mysql2 (LoadError)". On Windows XP with Ruby 2.0.0

The command rails server throws this error. C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': cannot load such file -- mysql2/2.0/mysql2 (LoadError) I use Ruby 2.0.0 from RubyInstaller on Windows XP…
Green
  • 28,742
  • 61
  • 158
  • 247
9
votes
9 answers

Database not being selected in rails project when attempting to rake db:migrate

Working with a rails app, having some manner of weird database / rake issues. When I execute: rake db:migrate I am getting the following error: Mysql2::Error: No database selected: SHOW TABLES (See full trace by running task with --trace) The…
re5et
  • 4,305
  • 3
  • 25
  • 26
9
votes
3 answers

Ruby Gem - LoadError

Ruby newbie here trying to figure out how to use a Gem and thus far the experience is not that great. After installing mysql2 via gem I tried to use it in a simple file. require 'mysql2' #client = Mysql2::Client.new(:host => "localhost", :username…
Tanner
  • 1,214
  • 3
  • 12
  • 16
9
votes
4 answers

mysql2 gem in gem list but getting project can not find gem

I am currently building a RoR project that requires the mysql2 gem. I successfully installed the gem. Because it is showing up in my gem list. [root@vc2cmmka035538n simple_cms]# gem list *** LOCAL GEMS *** actionmailer (3.2.3) actionpack…
beckah
  • 1,543
  • 6
  • 28
  • 61
9
votes
2 answers

Determine mysql2 server version using mysql2 Ruby gem

I'm using Rails and the mysql2 gem. Is there a way to get the mysqld server version as running the command: $ mysqld --version mysqld Ver 5.5.29 for osx10.8 on i386 (Source distribution) I do not wish to execute a shell command because the…
Abdo
  • 13,549
  • 10
  • 79
  • 98
8
votes
2 answers

Rails 3.1 / mysql2 error : "MySQL server has gone away"

I'm experiencing trouble upgrading my rails 2.3.14 / ruby 1.8.7 app to 3.1.1/1.9.2 : I have some (ActiveRecord::StatementInvalid) "Mysql2::Error: MySQL server has gone away" errors happening sporadically. It's important to precise that I never had…
Flackou
  • 3,631
  • 4
  • 27
  • 24
8
votes
3 answers

Mysql2::Client::LONG_PASSWORD (NameError)

I am trying to upgrade my ruby version from 2.4.5 to 2.4.9 in my rails app in Docker. After rebuilding my container it stops with the error: uninitialized constant Mysql2::Client::LONG_PASSWORD (NameError) My version of mysql2 gem is locked…
Jepzen
  • 2,942
  • 6
  • 40
  • 62
7
votes
2 answers

Error installing mysql2 gem on Debian Squeeze

I got this "popular" error while installing mysql2 gem on Debian Squeeze: gem install mysql2 Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. …
PascalTurbo
  • 2,189
  • 3
  • 24
  • 41
7
votes
3 answers

Unable to bundle install 'mysql2' on macOS Ventura caused by 'ld: library not found for -lzlib'

Unable to install mysql2 with bundle install. I'm asking because some sites and blogs have shown how to solve the problem caused by ssl, zstd, but I couldn't find a solution caused by zlib. Has anyone else faced the same problem? By the way, I am…
qounme
  • 73
  • 4
7
votes
2 answers

Arel Deprecation Warning when running rake db:create

I'm trying to create an app in Rails 3.1 with mysql2 v 0.2.6. When running rake db:create, I get the following error: DEPRECATION WARNING: Arel::Visitors::VISITORS is deprecated and will be removed. Database adatpers should define a visitor_for…
7
votes
5 answers

mysql2: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib after homebrew update

After I upgraded mac OS Mojave from v10.14.0 to v10.14.2 and all the packages installed with Homebrew I started getting the following error when I run bin/rails…
Hirurg103
  • 4,783
  • 2
  • 34
  • 50
7
votes
1 answer

MySQL 5.7.9, Rails 3.2, mysql2 0.3.20

I'm having issues after upgrading to MySQL 5.7.9 (installed via brew on OSX 10.11 El Capitan): all my legacy apps based on Rails 3.2.* stopped working. Note that I will use a new application as an example, but I need old applications with old…
tagliala
  • 169
  • 1
  • 11