zproject89
zproject89

Reputation: 245

Ruby can not require mysql

On Mac OS X 10.9.2, I use this command line on terminal to install mysql lib for Ruby:

sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install mysql2

And it shows:

Building native extensions.  This could take a while...
Successfully installed mysql2-0.3.15
Parsing documentation for mysql2-0.3.15
Done installing documentation for mysql2 after 0 seconds
1 gem installed

But I still can not use:

require 'rubygems'
require 'mysql'

It shows :

in `require': cannot load such file -- mysql (LoadError)

What should I do next?

Upvotes: 0

Views: 1133

Answers (1)

Jon
Jon

Reputation: 10898

You have installed the 'mysql2' gem. You need to require that gem within your code:

require 'mysql2'

Then everything should work just fine.

Upvotes: 2

Related Questions