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

Install mysql2 gem on Snow Leopard for Rails 3 with rvm

I have recently upgraded to Rails 3 and created a new application with Rails 3.0.3, but I keep getting an error Macintosh:$ rails server => Booting WEBrick => Rails 3.0.3 application starting in development on http://0.0.0.0:3000 => Call with -d to…
J Fong
  • 1,359
  • 1
  • 9
  • 11
31
votes
13 answers

bundle install problem: mysql.h is missing

in my mac OSX 10.6 32 bit, I can install mysql2 gem quite easily, but not in mini mac 10.6 64bit server. I have installed MySQL 5.5.11 in troublesome server, while in my home mac MySQL 5.5.0.m2 Somehow when I run bundle install, in server it tries…
jaycode
  • 2,926
  • 5
  • 35
  • 71
30
votes
7 answers

mysql2.so: libmysqlclient_r.so.15: cannot open shared object file: No such file or directory

I am trying to run a Rails two app with Ubuntu 10.04 server, sphinx, myql2 version 0.2.7 and percona server 5.5 (Myslql 5.5). mysql2 in irb works ok, I can connect to the db. this rails 2 app is working in another Centos server with MySql 5.1. When…
rtacconi
  • 14,317
  • 20
  • 66
  • 84
30
votes
4 answers

ld: library not found for -lzstd while bundle install for mysql2 gem Ruby on macOS Big Sur 11.4 Apple M1

while running bundle install An error occurred while installing mysql2 (0.5.3), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/'` succeeds before bundling. Rails app 6.1.3 Bundler version…
Jason FB
  • 4,752
  • 3
  • 38
  • 69
30
votes
6 answers

How do I resolve "incompatible library version" for mysql2 gem with ruby 2.3 on OS X?

I'm using ruby 2.3, and in the gemfile, I've got the mysql2 gem listed. But when I try to run rake db:migrate, I get the following: /Users/me/.gem/ruby/2.3.0/gems/mysql2-0.4.2/lib/mysql2.rb:31:in `require': incompatible library version -…
croceldon
  • 4,511
  • 11
  • 57
  • 92
26
votes
5 answers

Installing Mysql 2 gem fails

I am trying to install mysql2 (version 0.4.5) and I am using Rails 5.0.2, Ruby 2.3.1 I've already installed mysql server using homebrew (version 8.0.11)and started mysql as: brew install mysql brew services start mysql Gemfile.rb gem…
user8927599
26
votes
6 answers

Cannot install mysql2 gem for Rails project

I've looked at and tried just about everything on the topic here at Stackoverflow.com and still can't figure this out... When I 'gem install mysql2' I get a permissions error. when I 'sudo gem install mysql2' I get the following: …
Ted Martin
  • 281
  • 1
  • 3
  • 6
24
votes
4 answers

Migration to create table raises Mysql2::Error: Table doesn't exist

I wrote a migration with the following: class CreateTableSomeTable < ActiveRecord::Migration[5.1] def change create_table :some_tables do |t| t.references :user, foreign_key: true t.references :author, references: :user,…
Neil
  • 4,578
  • 14
  • 70
  • 155
22
votes
12 answers

Rails and Mysql2 Access denied for user 'root'@'localhost' (using password: NO)

I am somewhat new to Rails, and much of my experience involves me feeling out how to work out the problem so I apologize in advance if I have missed and obvious solution. I run a Windows machine. I am creating a log-in and registration using mysql2.…
spongezh22
  • 221
  • 1
  • 2
  • 3
21
votes
7 answers

Use MariaDB instead of MySQL in my Rails project

How can I use MariaDB instead of MySQL in my Rails project? When I try to install mysql2 gem it returns error,because mysqlclient was not found. Here some solution, but I didn't found any libmariadbd-dev package on my openSUSE 12.3.
rthink
  • 213
  • 1
  • 2
  • 6
20
votes
6 answers

Rails error installing mysql2 (mysql2-0.3.20)

I am trying to get a rails project up and running on my local machine. When I do bundle install Fetching mysql2 0.3.20 Installing mysql2 0.3.20 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current…
James Weber
  • 281
  • 1
  • 3
  • 7
19
votes
9 answers

Cannot install mysql2 gem

I'm unable to install the mysql2 gem in my Windows7 x64 system. I tried using both the 32-bit and 64-bit versions of MySQL server but none got me any further. I installed Ruby 1.8, the development kit and and the Rails platform. I even installed…
codingbunny
  • 3,989
  • 6
  • 29
  • 54
18
votes
7 answers

Undefined method `accept' for nil:NilClass on rake db:migrate

Using ruby-1.9.2 and rails 3.2.1. The version of mysql2 is 0.2.7. Upon running rake db:migrate I get the error: "undefined method `accept' for nil:NilClass:" Trace…
vectran
  • 1,961
  • 1
  • 14
  • 17
18
votes
1 answer

rescuing from Mysql2::Error

I have a simple question. I have a join table which has an index that ensure that (col 1, col 2) is unique. I am adding to that table using mysql2 gem and am trying to catch the Mysql2::Error if the attempt results in a duplicate key error. While I…
deruse
  • 2,851
  • 7
  • 40
  • 60
16
votes
7 answers

Unable to install MySQL2 gem on Windows 7

I am getting the following error message while installing, let me know if I need to post more details. I followed instructions from the following location: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit I am using ruby 1.9.2p136…
Lohith MV
  • 3,798
  • 11
  • 31
  • 44
1
2
3
60 61