Rails Application With Our Own Database



If we are working with rails version 2.X.X , the rails framework automatically create an application with sqlite as a default database. If we want to create the rails application with our selected database by using the following command..


Syntax : rails -d database_name app_name


Example :


rails -d mysql depot (OR)  rails shopping_cart -database=mysql


Here, depot and shopping_cart are the application names which we are going to create for rails.

How to import huge data file to MySQL

Recently I have a problem while importing the database file to mysql database using phpmyadmin. My file size has huge amount than they given. i.e. my file has morethan 2.5 MB.

For this, I have import and export data to database by using the following commands.

1) Import data to my database

E:\> mysql -u "mysql_user_name" -p"mysql_password" myapp_development < rails_backup.sql 

2) Export Data from database as sql file

E:\> mysql -u "mysql_user_name" -p"mysql_password" myapp_development > rails_backup.sql

Here "myapp_development" is my database name.