So, you wanna switch to MySQL?

The easiest way to make a rails project running on mysql is to start it with something like this:

rails your_project -d mysql

If you, however, have already started your project in a usual way, and it's now running with sqlite, it's still relatively easy to port it to and mysql.

First, you have to edit config/database.yml. You will find there something similar to this:

config/database.yml
development:
  adapter: sqlite3
  database: db/development.sqlite3
  timeout: 5000

This tells rails to use sqlite. We have to change this to:

config/database.yml
development:
#  adapter: sqlite3
#  database: db/development.sqlite3
  adapter: mysql
  database: your_project_development
  timeout: 5000

Notice that I commented out (not just deleted) old lines, and added two new settings for the mysql database. Replace 'your_project' with the actual name of your project, for example rails_space_development.

Do the same for the test and production databases.

The next step is to recreate the database with a new adapter. Run the following lines in your Ruby Console window:

rake db:create rake db:migrate

And, that's all, it should work now smoothly with MySQL.

Valid XHTML 1.0 Strict Valid CSS!