0

To make a Rails application with MySQL, I do the following:

rails new application -database=mysql

That doesn't work though, instead it gives my SQLite. I don't want SQLite, I want MySQL.

How can I solve this?

Jason
  • 177
  • 1
  • 1
  • 3

3 Answers3

5

I think you are looking at the command to create new rails app with mysql configuration in database.yml

rails new app --database mysql

I hope it answers your query.

Icicle
  • 1,174
  • 9
  • 13
3

First of all you need to install mysql2 in your system

sudo  gem install mysql2 -v=0.2.11

Once you have installed mysql2, then you are ready to create a new app with Mysql as default

rails new sample_app -d mysql
Tim
  • 1,853
  • 2
  • 24
  • 36
1

If you use bundler, then you should add

gem "mysql2"

to your Gemfile and run

bundle install

and then specify your database settings in config/database.yml

Shamir K.
  • 385
  • 2
  • 7