Another good reason to upgrade my wordpress version is the wordpress for iPhone. This software does not work in my old version. Now I can comfortably write my blog entry using my iPhone!
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:
- Backup the old wordpress directory
- Backup the mysql database being used the the blog
- Download and install the new wordpress software
- Copy certain files from the old version to the new version
- Upgrade the database
- 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:
- http://dev.mysql.com/doc/refman/5.0/en/not-enough-file-handles.html – to give you an understanding of the kinds of errors that mysql throws
- http://dev.mysql.com/doc/refman/5.1/en/repair.html – To solve the problem i faced with, which is a corrupted database file.
I had to run the following commands in order to solve the problem.
- /etc/init.id/mysqd stop
- cd /var/lib/mysql/blog_database_dir
- myisamchk *.MYI
- 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 =
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 =
WHERE option_name = ‘siteurl’;
To update the GUID with the new domain name enter:
And for any links to other pages or posts internally in your site with absolute URLs:
UPDATE wp_posts SET post_content =
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:
- backup the old wordpress directory using cp -r old-dir old-dir.bak
- backup the wp-config.php file and the wp-content directory. The rest can be deleted safely
- unzip the new wordpress software and cd to that directory
- 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.
- 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.
- start the mysql daemon
- Point your browser to http://your.domain.com/wp-admin. WordPress will detect that you need to upgrade your database. Just click on ok
- 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.