Moving to WordPress 2.5

One of reasons I used to use simplyphpblog is that I could easily copy the blog from stokebloke to my home PC where I normally have a mirror running.

I use Unison to mirror my hosted site to my home PC. Its similar to rsync but provides a nice UI to check diffs and choose which way to propagate changes.

I have stayed away from using php with mysql because I didn’t know of an easy way to mirror the MySQL databases. Without the MySQL database working on both the hosted site and my home PC I would have trouble making changes without possibly breaking my hosted site. I never like making change on my hosted server, its always been better to check locally before uploading any changes.

I finally decided to use MySQL and configure it for wordpress. Setting up a new wordpress blog on my server was very easy. I exported the database from the hosted site and synchronised all the files to my home PC.

mysqldump --user=<user> --password=<password> --host=<hostname> <database> > <date>.sql

The only thing left then was getting the mysql database to work without changing any wordpress configurations, as I’d probably upload the changes to my hosted site and break that.

Lucky my hosted site used an alias for the MySQL server ‘remotemysqlhost’. I simply had to add this host to my PCs hosts file (making it resolve to localhost) and it would try to connect locally. I created the database with the same name, users,password etc. I then imported the SQL dump into the database.

bash> /usr/bin/mysqladmin -u root create %lt;database>
bash> /usr/bin/mysql -u root
mysql> connect <database>
mysql> GRANT ALL PRIVILEGES ON *.* TO '<username>'@'<host>' IDENTIFIED BY '<password>' with grant option;
mysql> exit;
bash> /usr/bin/mysql -u root <database> < <date>.sql

For some reason the wordpress pages kept jumping back to I figured out the wordpress needed to know about my localhost. To trick wordpress into using localhost for the links I just needed to patch the wp_options table locally. I.e

update wp_options set option_value = "http://localhost/wordpress"
where option_name = "home";
update wp_options set option_value = "http://localhost/wordpress"
where option_name = "siteurl";

Obviously if you want to access your wordpress blog from other PCs localhost should be replaced with the real PC name.

With that the database was working and I could then start to work on making a theme for wordpress so it appears like the rest of my site.

I still have an issue with the Tag Cloud widget using font sizes which are too large for my theme, but I decided to not use the tag cloud in the end.

Leave a Reply