I want to create my Rails application with MySQL, because I like it so much. How can I do that in the latest version of Rails instead of the default SQLite?
If you already have a rails project, change the adapter in the
Next, make sure you edit your Gemfile to include the mysql or mysql2 or activerecord-jdbcmysql-adapter (if using jruby). |
||||
|
Normally, you would create a new Rails app using
To use MySQL, use
|
||||
|
If you are using rails 3 or greater version
if you have earlier version
So before you create your project you need to find the rails version. that you can find by
|
||||
|
is always your best friend usage:
also note that options should be given after the application name rails and mysql
rails and postgresql
|
||||
|
You should use the switch -D instead of -d because it will generate two apps and mysql with no documentation folders.
Alternatively you just use the |
|||
|
If you are creating a new rails application you can set the database using the -d switch like this:
Its always easy to switch your database later though, and using sqlite really is easier if you are developing on a Mac. |
||||
|
OR
Changes in config/database.yml
|
||||
|
Rails wiki always good for the very first layer configuration information. |
|||||
|