Things I needed to do to migrate to the latest and greatest version of WordPress

My wordpress version is very old already and I needed to upgrade to the latest version lest i will find it harder in the future to make use of the great functionalities and plugins of wordpress. And not only that, I also need to migrate my wordpress database from one domain name to this domain name because the other one is already expired. In order to migrate the old version to the new version we do the following:

  1. Backup the old wordpress directory
  2. Backup the mysql database being used the the blog
  3. Download and install the new wordpress software
  4. Copy certain files from the old version to the new version
  5. Upgrade the database
  6. reconfigure the new version

Here are the details:

To backup the mysql database:

mysqldump –add-drop-table -h localhost -u username -p password | bzip2 -c > blog.bak.sql.bz2

I encountered this error when doing this operation.

mysqldump: Got error: 1016: Can’t open file: ‘wp_comments.MYI’ (errno: 145) when using LOCK TABLES

I got the answer from this site:

I had to run the following commands in order to solve the problem.

  1. /etc/init.id/mysqd stop
  2. cd /var/lib/mysql/blog_database_dir
  3. myisamchk *.MYI
  4. Find out the file with the error, which in this case is wp_comments.MYI and run myisamchk -r wp_comments.MYI

Now that the database is safely backed-up, we now modify the database that contains references to the defunct domain. These instructions i got from this site: http://biven.org/writing/2008/migrating-wordpress-to-a-different-domain-or-server/. Thank you to the author for sharing his knowledge.

UPDATE wp_options SET option_value =

replace(option_value, ‘http://old.domain.com’, ‘http://new.domain.com’)

WHERE option_name = ‘home’;

And to change the WordPress Address (URL):

(remember if you have your WordPress files in its own separate directory this URL will be different than the Blog Address)

UPDATE wp_options SET option_value =

replace(option_value, ‘http://old.domain.com’, ‘http://new.domain.com’)

WHERE option_name = ‘siteurl’;

To update the GUID with the new domain name enter:

UPDATE wp_posts SET guid = replace(guid, ‘http://old.domain.com’,’http://new.domain.com’);

And for any links to other pages or posts internally in your site with absolute URLs:

UPDATE wp_posts SET post_content =

replace(post_content, ‘http://old.domain.com’, ‘http://new.domain.com’);

We just have updated the references of the old blog to the new domain. Now we can install the new wordpress software. All instructions can be found here: http://codex.wordpress.org/Upgrading_WordPress_Extended

The steps which I carried out are:

  1. backup the old wordpress directory using cp -r old-dir old-dir.bak
  2. backup the wp-config.php file and the wp-content directory. The rest can be deleted safely
  3. unzip the new wordpress software and cd to that directory
  4. Copy the wp-config.php.sample to wp-config.php and edit that file. Copy the database information from the old wp-config.php file to the new wp-config.php file and configure the auth_key, secure_auth_key, etc. near the bottom of the file.
  5. Copy the old themes and plugins to the wp-content/plugins and wp-content/themes directory. Also copy the “uploads” directory from the old wordpress to wp-content/ directory.
  6. start the mysql daemon
  7. Point your browser to http://your.domain.com/wp-admin. WordPress will detect that you need to upgrade your database. Just click on ok
  8. Now you can login to your wordpress as admin and reactivate your plugins and themes.

The fact that you are seeing this post is a proof that my installation was successful. This post should help me the next time i upgrade my wordpress installation.