So, you’re trying to get Rails going on Windows, and you’ve used the handy package at RubyInstaller.org, installed the equally handy Ruby DevKit, and now all you need to do is install the
mysql2 gem to get going.
At this point, if you do what any normal person might think to do, which is
gem install mysql2, you’ll fail because the gem wants a bunch of MySQL dev headers. That’s not a bad thing … we live in a world of dependencies that must be met.
One answer you can pursue is to download the big MySQL archive and pass a few flags along when you install the gem:
gem install mysql2 -- --with-mysql-lib="c:\Program Files\mysql\lib" --with-mysql-include="c:\Program Files\mysql\include"
Then be ready to tell Bundle the same thing for your Rails app proper, which I couldn’t get working.
What also works, and is much more simple, is just getting the version that works with Mingw32 build environments (which is what you get when you install the DevKit):
gem install mysql2 --version 0.2.6
gem 'mysql2', '0.2.6'
This is all, by the way, another lovely use case for VMWare: Freeze dry a VM at the point before you start desperately following whatever random advice you can find from people trying to make some portion of Ruby or Rails work on Windows so once you think you have it figured out you can roll back to a pristine state and make sure it all works before you document.
Have I mentioned Sequel Pro? If I haven’t, I should have.
It’s a Mac GUI for MySQL that’s good if you’re like me and don’t really like dealing with MySQL. It doesn’t cost anything, either.
A few things I like:
Easy record editing. You can double-click and make a quick change on the spot.
Easy export and import of selected or all tables in a database. When you’re in the “noodling around” phase of writing something that touches the db, it’s really easy to back in and out of changes quickly.
Simple view filters. If you’re not fond of a lot of typing just to find a few records, you can filter records from the data view. It’s not complex (you can only filter on a single column), but there are plenty of filters: contains, greater/less than, earlier/later than, etc.
Real queries. If the view filters aren’t complex enough, you can write real queries. It saves any queries you write in a history drop-down, and you can save them to a “favorites” list with a human-readable label. They’re syntax-highlighted, too.
It makes setting up a database pretty easy, too: auto-completion of column types and a little bit of guidance in setting up indexes.
There are some features I haven’t used yet (or as much), that also look pretty neat:
In some ways, it’s the best kind of training wheel software: It smooths out a lot of console-jockeying stuff, but doesn’t completely separate the user from what’s going on underneath. You still need to have some idea about what you’re trying to accomplish, but you spend less time worrying about the peculiarities of a particular interface style and can dip into the deeper waters as you learn.
It also makes it a lot easier to add database functionality to scripts, just because it makes managing a database so much easier. If you’re like me and tend to think in terms of ActiveRecord first, whatever the db backend you’re using second, Sequel Pro makes it easier to get to the good stuff faster.