Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Step 0</h2> <p>To be safe, I recommend experimenting a bit with this technique in a virtual machine. Save yourself a bunch of heartache and build a virtual machine, check out your code, and have a safe playground that you can throw away if tragedy strikes.</p> <h2>Step 1</h2> <p>Make a backup copy of your database.yml file.</p> <p>(from your application root)</p> <p><code>cp config/database.yml config.database.yml.sqlite3</code></p> <h2>Step 2</h2> <p>Make a backup copy of your data</p> <p>For Rails 3, install the YAML DB gem: <a href="https://github.com/ludicast/yaml_db" rel="noreferrer">https://github.com/ludicast/yaml_db</a></p> <p>For Rails 2.x install the YAML DB plugin:</p> <p><code>script/plugin install git://github.com/adamwiggins/yaml_db.git</code></p> <p>Run the dump task</p> <p><code>rake db:dump</code></p> <h2>Step 3</h2> <p>Update your config/database.yml file. You will find entries like </p> <pre><code>development: adapter: sqlite3 database: db/development.sqlite3 timeout: 5000 test: adapter: sqlite3 database: db/test.sqlite3 timeout: 5000 production: adapter: sqlite3 database: db/production.sqlite3 timeout: 5000 </code></pre> <p>Change them to </p> <pre><code>development: adapter: mysql encoding: utf8 reconnect: false database: **myapp_development** pool: 5 username: **root** password: **supersecretpassword** **socket: /opt/local/var/run/mysql5/mysqld.sock** test: adapter: mysql encoding: utf8 reconnect: false database: **myapp_test** pool: 5 username: **root** password: **supersecretpassword** socket: **/opt/local/var/run/mysql5/mysqld.sock** production: adapter: mysql encoding: utf8 reconnect: false database: **myapp_production** pool: 5 username: **root** password: **supersecretpassword** socket: **/opt/local/var/run/mysql5/mysqld.sock** </code></pre> <p>Be sure to update the values surrounded by asterix as appropriate for your platform! The socket value is only good for Mac OSX using MacPorts. Most flavors of linux do not require this value.</p> <h2>Step 5</h2> <p>If you have some errors in the following step, you might have to install the mysql gem:</p> <pre><code>sudo gem install mysql </code></pre> <p>Have rake create your database</p> <pre><code>rake db:create rake db:schema:load </code></pre> <h2>Step 6</h2> <p>Use YamlDb to reload your data into MySql</p> <p><code>rake db:load</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload