Instiki
Migrating to MySQL (Rev #8, changes)

Skip the Navigation Links | Home Page | All Pages | Recently Revised | Authors | Feeds | Export |

Showing changes from revision #7 to #8: (追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)

Table of Contents (Skip the Table of contents)

Instiki

So you’ve been running Instiki, for a while, with the default SQLite database engine. Now you’ve decided to migrate to a beefier alternative, like MySQL. Here’s how to migrate your data (based on an article by Al Hoang).

    (追記)
  1. Make sure you’re running Instiki 0.17.3 or later, and have run

     % rake upgrade_instiki

    This upgrades the database schema to the latest version. The previous schema (used in earlier versions of Instiki) could cause (data loss!) problems for some users, when migrating from SQLite3 to MySQL.

  2. (追記ここまで)
    (追記) (追記ここまで)
  3. Install the MySQL Gem

     % gem install mysql
  4. Set an environment variable in your shell.

    • Under sh and its cousins (bash, zsh, etc) type

      % RAILS_ENV=‘production’

    • Under csh and its cousins (tcsh, etc) type

      % setenv RAILS_ENV production

  5. Export your database to dump/fixtures/*.yml

     % rake db:fixtures:export_all
  6. Edit config/database.yml, replacing

     production:
    adapter: sqlite3
    database: db/production.db.sqlite3

    with something along the lines of

    production:
    adapter: mysql
    database: your_db_name
    username: your_db_username
    password: your_db_password
    host: 127.0.0.1
    port: 3306

    (The precise details will depend on your setup.)

  7. Create a database in MySQL, with the same name as the one you gave in database.yml, using something like

    % echo "create database your_db_name" | mysql -u your_db_username -p your_db_password
  8. Initialize the database tables and reimport your data

     % rake db:migrate
     % rake db:fixtures:import_all
Revision from October 28, 2009 22:51:10 by Jacques Distler
Forward in time (28 more) | Back in time (7 more) | See current | Hide changes | History | Rollback | View: Source | Linked from: Upgrading, News, Installing on Shared Hosts, Known Bugs, Run on Port 80

AltStyle によって変換されたページ (->オリジナル) /