0

I'm new to Rails and I'm going through a tutorial on Lynda.com, Rails 4 Essentials. I'm on a Windows 7 x64 machine and I'm trying to connect the MySQL database to the Rails app. I've successfully created the database and created a new user.

I had issues running the mysql2 gem and I could only get version 0.3.11 to work (it's on version 0.3.16 as of this post). I copied the libmysql.dll from the C:\Program Files\MySQL\MySQL Connector.C 6.1\lib to my C:\RailsInstaller\Ruby2.0.0\bin directory as the instructions stated.

Everything seems to be ok at this point.

I configured my database.yml file to match my database credentials (I had to create this from scratch, nothing was generated when I ran mysql2).

#config\database.yml
development:
  adapter: mysql2
  database: simple_cms_development
  username: craig
  password: password
  host: 127.0.0.1
  socket: /tmp/mysql.sock

test:
  adapter: mysql2
  database: simple_cms_test
  username: craig
  password: password
  host: 127.0.0.1
  socket: /tmp/mysql.sock

production:
  adapter: mysql2
  database: simple_cms_production
  username: craig
  password: password
  host: 127.0.0.1
  socket: /tmp/mysql.sock

I got to try to connect my database with MySQL using:

rake db:schema:dump

and I get this crap:

LoadError: cannot load such file -- mysql2/2.0/mysql2

I see a directory called mysql2/1.9 and there is a file called mysql.so in there but there is no 2.0.

Any ideas? Thanks!

Craigfoo
  • 313
  • 2
  • 12

2 Answers2

0

The joys of developing on a windows machine :)

I suggest you check this question - it looks like the same problem.

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

Community
  • 1
  • 1
Hoffa
  • 197
  • 1
  • 1
  • 12
  • I should have mentioned I went through that thread with not luck. Still trying... – Craigfoo Nov 09 '14 at 13:58
  • ok, next guess, it's a path problem. Can you (from your rails directory) type `mysql2/2.0/mysql2` and get anything? Try to find that mysql2 file. Sorry I'm not much help, I switched to Mac and haven't had to go through this grief. – Hoffa Nov 09 '14 at 20:09
0

I managed to get passed this issue by starting fresh. I followed these set of videos to set up Ruby, MySQL, and Rails on my Windows 7 x64 machine.

http://youtu.be/C5S7vjN6GLc

Worked like a gem, I'm rockin' and rollin' now.

Craigfoo
  • 313
  • 2
  • 12