Skip to content

Create Databases for Rails with MySQL

November 27, 2010

Want to use Rails with MySQL ? You will have to create the right databases. Here is what I the book recommends:

shell>mysqladmin -u root create database_name

or

shell>mysqladmin -u root -p create database_name

and give the password

or try this

shell> rake db:create

check this http://ryandaigle.com/articles/2007/5/29/what-s-new-in-edge-rails-new-database-rake-tasks

(it just creates the databases required for the rails applcations, both develoment and test. does not need the name. it it is a rails thing. it takes it from the database.yml file. )

Before looking at the book, this is what I found, which, fyi,  I now find unnecessary

http://www.tutorialspoint.com/ruby-on-rails/rails-database-setup.htm

Note: I am not using password. So what I did is:

mysql> create database database_name;
Query OK, 1 row affected (0.01 sec)

mysql> grant all privileges on database_name.*
to 'root'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: