Archive

Archive for July, 2009

Fixing WordPress Upgrade Errors [Table 'wp_terms' doesn't exist]

July 8th, 2009 derek No comments

If you have ever seen one of these exceptionally annoying errors populating your apache logs after upgrading wordpress:
WordPress database error Table 'database.wp_terms' doesn't exist for query SELECT t.*, tt.* FROM wp_
terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.
taxonomy IN ('category') AND ( t.term_id <> 1 ) ORDER BY t.name ASC made by require, require_once, include, get_sidebar, locate_template, load_template, require_once, wp_list_cats, wp_list_categories, get_categories, get_terms

There is a relatively easy fix, however, finding it was not so easy.

I found a pointer here:

http://osterman.com/wordpress/2007/10/15/wordpress-database-error-table-wp_terms-doesnt-exist

However, this didn’t work for me. The page always mentioned the database was already upgraded. Digging around on the WordPress Codex, revealed this handy link about forcing a database upgrade.

Here is what I did to fix the problem

Open mysql and select the db:
[root@host ~]# mysql -u dbuser -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15762
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use wordpress;

Database changed

Next change the value of the DB to a previous version or wordpress (check here for a list of values).
mysql> update wp_options set option_value='6124' where option_name="db_version";

Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql>

Next, run the upgrade script:

http://domain/wordpress/wp-admin/upgrade.php

If you receive errors, change the db_version to a different value and try again.

Categories: General, Tech Tags: , , ,