I recently upgraded a site from 2.2.3 to 2.3 to 2.5.1 to 2.7.1. This is from memory, but I believe running the 2.3 upgrade.php just showed a blank page. Then the 2.5 upgrade complained about WordPress database errors (stuff like “Duplicate entry ‘1’ for key 1”) but said it upgraded — and it created the taxonomy structure although did not create relationships. And the 2.5 upgrade caused a recursion loop when subsequently trying to access the backend. But the 2.7.1 straightened that out, although relationships were still missing.
So, after a bit of spelunking around in the term tables, I put together the following script:
#! /bin/sh
awk '/INSERT INTO wp_post2cat/ { print $6 + 0, $7 + 0 }' $1 \
| sort -n \
| awk '{ printf \
"INSERT INTO wp_term_relationships VALUES (%d,%d,0);\n" \
"UPDATE wp_term_taxonomy SET count = count + 1 WHERE term_id = %d;\n", \
$1, $2, $2; }'
Basically, all that was missing was a row in relationships that linked a post (object_id) to a category (term_id). (You also need to bump the count for that term_id.) So if you have a SQL dump from before the upgrade attempt, you can feed it to the above script, save the output to a file and feed that back into mysql.