“You do not have sufficient permissions to access this page” after WordPress upgrade

If you’ve done a wordpress upgrade which included either copying another wp database or changing the current one’s table prefix (as well as changing the $table_prefix PHP variable in your config file,) you will most likely be met with this warning when you try to log in:

You do not have sufficient permissions to access this page.

The reason for this is that everything in wordpress that accesses info in the db does so from PHP using the $table_prefix variable, and when you first installed your blog, a couple of options are set in the database that include that value, which makes it not really so dynamic! 😉

After rooting through my db, I found 5 or 6 values that still had the old table prefix in – mostly in the `usermeta` table, but also one in the `options` table. To make sure I got them all, I ran these simple SQL statements in phpMyAdmin to update all the values:

UPDATE `wp2_usermeta` SET `meta_key` = REPLACE(`meta_key`, 'wp_', 'wp2_');
UPDATE `wp2_options` SET `option_name` = REPLACE(`option_name`, 'wp_', 'wp2_');

(note: please be sure to backup your database before you execute any SQL on it – if something goes wrong, there’s not a lot you can do to recover it without a backup!)

In those two examples, assume the original prefix was “wp” and the new one is “wp2”.

With that done, I can now log in to my newly upgraded blog again! 🙂

17 Responses to “You do not have sufficient permissions to access this page” after WordPress upgrade

  1.  

    hey I seem to be getting this error message when I try to access the options and configuration for this plugin:

    softsift.com/thumbnail-summary-plugin

    I was wondering if you can help me fix this so that I can access this plugin from my settings panel of wordpress 2.8.2

    all of my other plugs work and can be accessed under the settings panel of wordpress admin. but this one doesnt for some reason

  2.  

    It just don’t make sense to me, plain damn weird…

  3.  
  4.  

    hmmm, great post

  5.  

    Thanks man! Pffew, I thought I had messed up my DB after changing the prefix…

  6.  
  7.  

    Great help after I changed the table prefix on my install.

    Thanks!!

  8.  

    Thanks so much! You saved me a lot of hassle sleuthing this one out.

  9.  
  10.  

    I’m moving my sites and databases from one server to another. I noticed that in the process, I had originally setup the table with the default wp_ prefix. I did an export then opened it up with my text editor, did a search and replace for each of the table names changing them all to the new prefix and did an import.

    Boom, I get You do not have sufficient permissions to access this page and wondered what happened.

    Long story short, I read your fix, gave it a shot and it worked like a charm. Thanks for taking the time to post your solution!

    Kay

  11.  

    Thank you so much for this post, I was locked out of my fresh new WP install and freaking out a bit when I was unable to log back in. This post kept me from starting over from scratch!

  12.  

    OMFG I LOVE YOU. hours, bro. I forgot I even changed the prefix!

  13.  

    AWESOME!! I looked at about 20 post that did not resolve the issue before I found yours. Thank you!!!!

  14.  

    has not worked for me….still cannot login

  15.  

    Thnx for your post, with this i have solved my problem 🙂

  16.  

    i got the solution , thnks bro

  17.  

    This solution fix my problem, Thank you! 🙂

leave your comment