*here is a solution for the **windows users**, hope it helps!*
<h2>Using MySQL with Rails 3 on Windows</h2>
- **Install railsinstaller** -> *www.railsinstaller.org* (I installed it to c:\Rails)
- **Install MySQL** (I used MySQL 5.5) -> *dev.mysql.com/downloads/installer/*
> **--- for mySQL installation ---**
<br /><br /> If you dont already have **these two files** installed you might need them to get your MySQL going<br /><br />
vcredist_x86.exe ->
[To see links please register here]
dotNetFx40_Full_x86_x64.exe ->
[To see links please register here]
<br /><br />
Use default install
Developer Machine
> **-MySQL Server Config-**<br />
port: 3306<br />
windows service name: MySQL55<br />
mysql root pass: root (you can change this later)<br />
(username: root)<br />
**-MySQL Server Config-**
> **--- for mySQL installation ---**
<br />
> **--- Install the mysql2 Gem ---**<br /><br />
Important: **Do this with Git Bash Command Line**(this was installed with railsinstaller) -> start/Git Bash<br /><br />
<i>**gem install mysql2 -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Server 5.5\lib" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5.5\include"'**</i>
<br />
Now the gem should have installed correctly
<br />
Lastly copy the libmysql.dll file from<br />
C:\Program Files\MySQL\MySQL Server 5.5\lib<br />
to<br />
C:\Rails\Ruby1.9.2\bin<br /><br />
**--- Install the mysql2 Gem ---**
<br />
*You will now be able to use your Rails app with MySQL, if you are not sure how to create a Rails 3 app with MySQL read on...*
<hr />
**--- Get a Rails 3 app going with MySQL ---**<br /><br />
Open command prompt(not Git Bash) -> start/cmd<br />
Navigate to your <Sites> folder (c:\Sites)<br />
Create new rails app<br />
rails new world
Delete the file c:\Sites\world\public\index.html<br />
Edit the file c:\Sites\world\config\routes.rb<br />
add this line -> root :to => 'cities#index'<br /><br />
Open command prompt (generate views and controllers)<br />
rails generate scaffold city ID:integer Name:string CountryCode:string District:string Population:integer
<br />
Edit the file c:\Sites\world\app\models\city.rb to look like this
class City < ActiveRecord::Base
set_table_name "city"
end
Edit the file c:\Sites\world\config\database.yml to look like this
development:
adapter: mysql2
encoding: utf8
database: world
pool: 5
username: root
password: root
socket: /tmp/mysql.sock
add to gemfile
gem 'mysql2'
Open **command prompt** windows cmd, not Git Bash(run your app!)<br />
Navigate to your app folder (c:\Sites\world)<br />
rails s
Open your browser here -> *http://localhost:3000*
**--- Get a Rails 3 app going with MySQL ---**