Losing my mind over MySQL

Hi everyone,

I’ve been trying to get MySql running with Ruby and I’m losing my mind
over it. I’ve tried on two different machines and no luck so far. Here’s
what’s happening:

  1. I’ve installed Ruby 2.1.5 x64
  2. I’ve installed DevTools x64
  3. I’ve installed Rails (via gem)
  4. I’ve tried installing mysql or mysql2, but I keep getting “Failed to
    build gem native extension” errors.
  5. After googling for an answer, I’ve finally managed to get mysql
    installed by using the latest ConnectorC. However, this results in
    Segmentation fault errors after using require “mysql”.

How is Ruby supposed to ease my job again?

Both of the machines had Windows 7 x64 running.

You may find that not all gems support x64 compiling on windows. Maybe
try the 32 bit version?

Hi Joel,

thanks for the reply. I did think of that. Shortly after posting the
message, I uninstalled everything and downloaded 32bit Ruby, DevKit and
MySql. Still no luck, I just couldn’t get it to work. Besides, it’s not
like I’m trying to use some obscure gem; this is MySql that should work
out of the box.

This are my notes:
"MySQL => GitHub - brianmario/mysql2: A modern, simple and very fast Mysql library for Ruby - binding to libmysql

  1. Download the MySql C Connector from:
    http://dev.mysql.com/downloads/connector/c/
    NOTE: Don’t download the installer, download the ARCHIVE for your OS.
  2. Extract the file to C:\mysql-connector
  3. Then ran:
    gem install mysql2 --platform=ruby –
    ‘–with-mysql-dir=“C:\mysql-connector”’

Oh and lastly if you get an error regarding the mysql2 gem when you do
RAILS S you need to copy the libmysql.dll from the LIB directory of the
mysql connector to the bin directory where rails has been installed."

Check if works this way. Tested with Ruby 2.0 x86, DevTools x86.

If this doesn’t work, consider use x86 version of Ruby, DevKit and so
on, all x86, not x64.