this blog is girtby.net

Posted
18 February 2005

Categories
Nerd Factor X

Tags

6 Comments

HOWTO: Set up a Local Mirror of Your Wordpress Blog on MacOS X

Here’s what I did to set up a local mirror of my Wordpress blog on MacOS X. Please let me know if it’s useful, and I will try to update this from time to time.

Firstly, why do this? Well I can think of a few reasons:

  • keeping an up-to-date and working backup
  • using it for testing changes to the blog before you inflict them on the world. Like formatting, software updates, or anything really.
  • It’s fun (except for the MySQL setup, which we’ll get to)

Update: I have moved this HOWTO to a new page. Please update your bookmarks.

6 Comments

Posted by
darusha
2005-02-17 23:01:00 -0600
#

Very cool. Just 15 minutes ago I was thinking “this (fooling around with my Wordpress installation) would be so much better if I could just test things locally first, but I have no ideas how to set up mySQL”. Now I have a project for this weekend. Thanks!


Posted by
darusha
2005-02-17 23:01:00 -0600
#

Excellent instuctions! I did it a little differently, and installed a clean WP installation to use as a sandbox, but the mySQL info was invaluable.

One thing I came across when I was setting up my database, was that I had to use two steps as follows:

mysql> grant all on example_db.* to example_db2@localhost; Query OK, 0 rows affected (0.01 sec)

mysql> SET PASSWORD for example_db@localhost = PASSWORD(‘example_pw’); Query OK, 0 rows affected (0.10 sec)

But we’re up and running now!


Posted by
hendrik
2005-02-17 23:01:00 -0600
#

i had the same problem – wanting to have a working of my wordpress run site on my powerbook so if i play i do not break my live site …

maybe i can help you with your outstanding issue: the basic idea is to ssh to the server running the live site, run mysqldump on it, pipe the output through sed in order to replace the internet urls with local urls and pipe it into a mysql client running on your mac which in turn executes the sql statements and does the database update – to make a long story short:

ssh server mysqldump –add-drop-table -u user –password=password database sed -e ‘s%yoursite.com%mac.local/~user/yoursite%g’ mysql -u user –password=password database

you should set up public key authentication with ssh (run ssh-keygen on your mac, append $HOME/.ssh/id_dsa.pub from your mac to the file $HOME/.ssh/authorized_keys on your server) , then this command could run unattended.

i can see two drawbacks/things to consider – this setup works for me, but YMMV:

  • every time you run this command the whole db is copied, not only the changes (maybe i come up with a better idea at some point …)
  • every occurance of the string yoursite.com is replaced with mac.local/~user/yoursite, not only the urls and home settings, so if somebody puts yoursite.com in post/comment/page it will also be replaced

Posted by
alastair
2005-02-17 23:01:00 -0600
#

darusha: Thanks for the info, will update.

hendrik: good ideas, but I dont want to assume ssh access. A similar technique might work with curl for those who, like me, can get access to their database dump from cPanel (ie a web interface for administering a hosting account).

At the moment I’m toying with running an SQL UPDATE command to do the correct URL substitution in the database.


[…] n de Sleep mode Lokale weblog kopie Als je een weblog beheert is deze handleiding om op je eigen computer een kop […]


Posted by

2005-02-17 23:01:00 -0600
#

[…] > WP spegla