Rails and MySQL

I decided to use MySQL with Rails on my Ubuntu and Windows machines. On Windows I use RailsInstaller, and I was able to install the gem with

gem install mysql2

It even seemed to compile stuff, or it got a precompiled gem. I saw this in the console:

Fetching: mysql2-0.3.11-x86-mingw32.gem (100%)

For Ubuntu, there were a few more issues. First I has to install some packages:

apt-get install libmysql-ruby libmysqlclient-dev

Then I could run the gem install command:

gem install mysql2

Then in the development section of config/database.yml I had to comment out the following line:

# socket: /tmp/mysql.sock

I added mysql2 to the Gemfile

gem 'mysql2'

Then I could generate scaffolds:

rails generate scaffold podcast name:string rss:string year:integer
rails generate scaffold city name:string state:string

Here are the create statements and some helpful commands:

create database rails_001;
grant all privileges on rails_001.* to 'rails_001-admin'@'%' identified by 'Contact-001' with grant option;
grant all privileges on rails_001.* to 'rails_001-admin'@'localhost' identified by 'Contact-001' with grant option;
flush privileges;
commit;
# upload data from a file
mysql --user=rails_001-admin --password=Contact-001 < /path/to/dump/file/dump.2011-10-13_16.46.41 
mysql --user=rails_001-admin --password=Contact-001 --database=rails_001