Site stuck in “Database Update Required” loop

I just updated to 3.1.3 and now when I go to the admin I get the “Database Update Required” /wp-admin/upgrade.php screen. I click ‘Upgrade Now’ and it says it’s done, but then trying to access anything in the admin gets me the same screen again. How do I get past this?

EDIT: In trying to use toscho’s solution, I discovered that my wordpress db tables are not writable, which likely led to the error loop. Any ideas for how to track that down?

Related posts

Leave a Reply

7 comments

  1. 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.

  2. 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?

  3. 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.

  4. I just had the same problem and I got to see there was no space left on device. Database could not save data, so it could not update. For some users, it is worth checking.

  5. For me it was permissions of the DB user and the DB. They were too strict, once I gave the user ALL privileges, I was able to get passed the loop.

    Either fix the user permissions of your SQL user, or use root if you have access to that SQL user.