I know that you have to change the database.yml but I don't know what to change it to and how to download MYSQL and all of that jazz.
The quickest and easiest way to convert SQLite to MySQL is by exporting an SQL Database to a Dump File, and then importing the SQLite Dump into MySQL Database. You can export an SQLite Database to Dump File using the . dump command.
Rails defaults to using a SQLite database when creating a new project, but you can always change it later.
Gemfile:
gem 'mysql2'
config/database.yml
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: db_name_here
pool: 5
username: root
password:
host: localhost
Command line:
bundle install
rake db:create
rake db:migrate
Of course MySQL needs to be installed.
If you're creating a new project:
rails new app_name_here -d mysql
I ran into the same problem when trying to use the mysql2 gem with Rails 3.0.9.
When I ran rake db:create
after installing the mysql2 gem, it gave me these warnings:
WARNING: This version of mysql2 (0.3.6) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
To specify that you only want to use the 0.2.x versions of mysql2, edit your Gemfile so that
gem 'mysql2'
becomes
gem 'mysql2', '~> 0.2.1'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With