Wordpress - Site stuck in "Database Update Required" loop

I had the same problem recently. For some reason the option db_upgraded isn’t set by the upgrade process.

Fix

  1. Go to /wp-admin/options.php.
  2. Fill the field db_upgraded with a 0 (zero).
  3. Hit Save Changes.

Done.


If you didn't disable all your plugins before updating do it manually by renaming the wp-content/plugins directory.

Clear your browsers cache and all cookies and try again.

If your still having the problem open the file wp-includes/version.php to make sure it is the correct file for 3.1.3.

You should see this database version:

/**
 * The WordPress version string
 *
 * @global string $wp_version
 */
$wp_version = '3.1.3';

/**
 * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
 *
 * @global int $wp_db_version
 */
$wp_db_version = 17516;

If everything checks out and your still having the problem add this to your wp-config.php file:

define('WP_ALLOW_REPAIR', true);

Navigate to : yoursite.com/wp-admin/maint/repair.php to attempt a database repair.

What WordPress version are you updating from?


Discovered that the db files I copied over from another machine had incorrect ownership. Once I chown -R mysql:mysql myblogdbdirectory and restarted MySQL, the database upgrade worked.