This is how you do it.
gem list --local
Displays a list of installed gems. Do you see mysql2 gem? If mysql2 is not installed, run
gem install mysql2
You are now ready to launch the new rails app. Go to the desired directory and run
rails new my_app -d mysql
This will create a new rails application in the my_app directory with mysql binding. Go to the application directory and run
rake about
If everything is fine, you should see the following
Database adapter mysql2
Leave your favorite text editor and go to config / database.yml. Note that there are three databases, one for development, testing, and production. The user will be root, but without a password. Enter the root password in all three places. You can also change the user.
then open mysql and create three databases
mysql -u root -p create database my_app_production; create database my_app_test; create database my_app_development; exit
next in terminal type
rails generate scaffold TableName name:string due:date etc... rake db:migrate
... and you're done. Hope this helps.
source share