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
15
votes
2 answers

Rake mysql2 "unknown database" error

I'm following instructions from a hand-over package from a previous group. I don't know too much about rails or mysql2. I am on Windows. When I do: rake db:migrate RAILS_ENV=production This is the output: C:\jcccf-goslowserver-e30bf00>rake…
Jeremy
  • 5,365
  • 14
  • 51
  • 80
15
votes
4 answers

ld: library not found for -lssl while installing mysql2 gem

I changed mysql2 version in my project's Gemfile from 0.3.20 to 0.5.2. When I run bundle update mysql2 I get the following error: Fetching mysql2 0.5.2 (was 0.3.21) Installing mysql2 0.5.2 (was 0.3.21) with native extensions Gem::Ext::BuildError:…
Hirurg103
  • 4,783
  • 2
  • 34
  • 50
15
votes
1 answer

mysql2 gem not working after updating to Ubuntu 16.04 - libmysqlclient.so.18

Everything worked fine prior to the update. Using ruby 1.9.3p392 with RVM with rails (3.2.12) Using MySQL 5.7.16 and Nginx and Unicorn Log shows LoadError: libmysqlclient.so.18: cannot open shared object file: No such file or directory -…
Henri
  • 983
  • 3
  • 11
  • 29
15
votes
1 answer

gem install mysql2 v '0.3.11' not working on Yosemite

When doing bundle install or direct gem install of mysql2 version 0.3.11 on ruby version 1.9.3 (rvm) I'm getting the error below. But when I install the latest version 0.3.16 it works. I also included my gcc version for…
steamboy
  • 1,162
  • 5
  • 20
  • 37
15
votes
4 answers

MySQL2 gem won't install

I have been trying to install Gitlab on my Ubuntu 12.04 server for a long time, and all goes well until I run bundle install. It says it is unable to install MySQL2 but gives no reason or corrective action. home/gitlab/gitlab$ sudo -u gitlab -H…
BMC
  • 591
  • 3
  • 7
  • 22
15
votes
7 answers

Rails development - Can't connect to MySQL server on 'localhost' (10061)

I'm a Rails developer newbie using MySQL as the database. I can successfully connect to MySQL using the command: MySQL -u macDaddy -p at the command prompt, so I know the user is valid and MySQL is running. But when I try to run rake…
14
votes
4 answers

Mysql2 Error MySQL server has gone away

I am getting this error occasionally. I have read some solutions in stackoverflow but they were about rails 2 or mysql. Any help will be appreciated. ActiveRecord::StatementInvalid (Mysql2::Error: MySQL server has gone away
ziCk
  • 141
  • 1
  • 1
  • 3
14
votes
2 answers

Rails 3 - Incorrect MySQL client library version! Gem compiled for the wrong client library version

I cloned the github repo https://github.com/8bitpal/hackful, run 'bundle install' and now 'rake db:create'. But I get an error message: Incorrect MySQL client library version! This gem was compiled for 5.0.45 but the client library is 5.5.15. Tried…
hebe
  • 387
  • 1
  • 2
  • 14
13
votes
3 answers

Using fork in Ruby on Rails for creating parallel process

I have a Rails 3 app in production with Passenger on Apache. I have this code: class Billing < ActiveRecord::Base after_save :sendEmails private def sendEmails fork do UserMailer.clientBilling(self.user, self).deliver …
pablomarti
  • 2,087
  • 2
  • 22
  • 35
13
votes
7 answers

rake db:migrate error with mysql2 gem - Library not loaded: libssl.1.0.0.dylib

Getting the following error after running rake db:migrate rake aborted! LoadError: dlopen(/Users/scott/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.10/lib/mysql2/mysql2.bundle, 9): Library not loaded: libssl.1.0.0.dylib Referenced…
s89_
  • 1,533
  • 3
  • 25
  • 40
13
votes
2 answers

mysql2 gem 0.3.15 gives ASCII-8BIT with encoding set to "utf8"

I am using MySQL 5.1.71 with Rails 4.0.4 running on Ruby 2.0.0-p353 (via rbenv + ruby-build), with mysql2 gem 0.3.15. CentOS 6.5. In database.yml, encoding is set to "utf8" and adapter is "mysql2" for all environments. My tables are all using UTF-8,…
Sami Samhuri
  • 1,540
  • 17
  • 21
12
votes
15 answers

Ruby mysql2 gem compiled for wrong mysql client library version

After updating MySQL to 5.5 using apt-get, the mysql2 gem stopped working. Here's the error: Incorrect MySQL client library version! This gem was compiled for 5.5.17 but the client library is 5.1.58. (RuntimeError) I tried reinstalling with…
Marco
  • 4,345
  • 6
  • 43
  • 77
12
votes
4 answers

Rails & MySQL on Apple Silicon

has anyone been able to get Rails running with the MySQL via the mysql2 gem on Apple Silicon? I'm working with Ruby 2.5.3 and Rails 5.2.3 but would love to hear of any successes with any versions. Currently I am stuck with the mysql2 gem install…
Eskim0
  • 775
  • 7
  • 17
12
votes
5 answers

Why does Rails 3 with Mysql2 Gem ActiveRecord::Base.connection.execute(sql) return Array not Hash?

I'm in the process of upgrading an application to Rails 3. I've decided to go with the mysql2 gem. There's some legacy code in the app that makes calls like: results = ActiveRecord::Base.connection.execute(sql) In the 2.3.x version, it…
pduey
  • 3,706
  • 2
  • 23
  • 31
12
votes
2 answers

Is it possible to use gem mysql2 with rails 2.3?

I can't find anything related to how to use mysql2 with rails 2.3. Is it possible to use these two together? I want to use mysql2 since I think it would help the performance my rails 2.3 app.
Chamnap
  • 4,666
  • 2
  • 34
  • 46
1 2
3
60 61