Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Switching from SQLite to MySQL

mjgiarlo edited this page Nov 1, 2012 · 10 revisions
  1. (OPTIONAL) If you care about the data in your DB, dump it: rake db:data:dump
  2. Install MySQL (if you haven't already)
  • sudo apt-get install mysql-server (on Ubuntu)
  1. Edit config/database.yml to point at MySQL instead of SQLite
  1. Create a user account for the app in MySQL
  • CREATE USER 'user'@'localhost' IDENTIFIED BY 'pass';
    • (note this account will only work on your local machine)
  1. Grant this account privileges to scholarsphere_development, scholarsphere_test, and scholarsphere_production
  • GRANT ALL PRIVILEGES ON scholarsphere_development.* TO 'user'@'localhost';
  • GRANT ALL PRIVILEGES ON scholarsphere_test.* TO 'user'@'localhost';
  • GRANT ALL PRIVILEGES ON scholarsphere_production.* TO 'user'@'localhost';
  1. Create the dev and test databases: rake db:create, followed by RAILS_ENV=test rake db:create
  • If you get MySQL errors around here, it could be you need to refresh the MySQL gem within bundler as you may have already built it w/ native extensions on an earlier version of MySQL. If that's the case, try gem uninstall mysql followed by bundle install
  1. Migrate the dev and test databases: rake db:migrate, follwed by RAILS_ENV=test rake db:migrate
  2. (OPTIONAL) Load the data you dumped earlier: rake db:data:load
  3. (OPTIONAL) If you run 'rake db:data:load' you must run git checkout db/data.yml
Clone this wiki locally