All versions of Rails prior to 3.2.11 have a serious security bug. Time to upgrade. Note that this machine has MySQL version 5, so step 7 is necessary for me. If you have MySQL version 6, copy libmysql.dll from there if it isn’t already on the path.
1. Install the latest version of Ruby (currently 1.9.3-p362)
a. Follow the instructions on rubyinstaller.org
b. I am installing to C:\ruby\193-p362. This way I don’t step on any previous version of Ruby – important to not break running programs/web sites.
c. I didn’t check any of the three boxes (Tcl/Tk support, Add Ruby executables to your PATH, or Associate .rb and .rbw files) with this Ruby installation.
d. I already have the latest version of DevKit installed to C:\ruby\DevKit-32-4.5.2. I suggest that you install DevKit on a path that does not include a specific version of Ruby.
1. cd c:\ruby\DevKit-32-4.5.2
2. ruby dk.rb init
3. edit config.yml to add or remove other Rubies
4. ruby dk.rb install
2. install or update pik (to install pik, see my February 18, 2012 entry Upgrading to Ruby 1.9.3 and Rails 3.2 on Windows)
a. pik update –no-ri –no-rdoc
3. Add this ruby to pik
a. pik add C:\ruby\193-p362\bin
4. Use this version of ruby
a. pik use ruby 1.9.3p362 (Note: The is no dash between the version and the p)
I put this in a batch file, rather than have it load automatically with cmd.
5. gem install rails –no-ri –no-rdoc
6. gem install mysql2 –no-ri –no-rdoc
7. copy version 6 of libmysql.dll to C:\ruby\193-p362\bin (same directory as this version of ruby.exe)
a. download it from the site shown on the gem install mysql2 or
http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick
8. rails new yourproject -d mysql
9. cd yourproject
Next, prepare to test:
1. Create your MySQL database if you haven’t already
2. Edit config/database.yaml so that database, username, and password match
3. rails s
4. http://localhost:3000
5. Click on About your application’s environment