first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

DreamHost: Maintaining an Offline Copy of WordPress

This note refers to WordPress 2.2.2 from a DreamHost bash shell to an Ubuntu VM.

Script mysqldump on the DreamHost server to export WordPress data. This is an example:

mysqldump --opt -u myuser -p -h mydbdomain.com my_wp_db \\
    --ignore-table=my_wp_db.wp_sk2_logs \\
    --ignore-table=my_wp_db.wp_sk2_spams \\
    --default-character-set="latin1" >mydb_bak.sql

Script rsync to copy/overwrite the SQL backup (mydb_bak.sql).

Script rsync to overwrite the local WordPress installation. This is an example:

rsync -e ssh -ar --delete-after \\
    --exclude '*wp-content/themes*' \\
    --progress \\
    --stats \\
    me@mydomain.com:myremotesite/wordpressfolder/ mylocalsite/wordpressfolder/

Note that the freaking, huge themes folder is excluded.

Use phpMyAdmin or mysql to load the SQL backup. Eventually the file size of the backup will get so large that you might have to use mysql exclusively to avoid screwing around with PHP settings.

Use phpMyAdmin (or mysql) to update the following WordPress options for your local (offline) web server:

option_name='siteurl'
option_name='home'

These changes to the database should be enough to get the off-line site displaying properly. However, the enhanced security on DreamHost.com may prevent your local web server from loading wp-config.php. You might have to make sure that others can read this file on your local machine.

Edit wp-config.php with lines like the following:

define('DB_NAME', 'your_local_wp_db');
define('DB_HOST', 'localhost');

You might need to change DB_USER and DB_PASSWORD as well.

mod date: 2007-09-07T20:22:52.000Z