Aug
28

How to solve ‘You do not have sufficient permissions to access this page.’ in WordPress

Uncategorized

I have been running into troubles logging in to WordPress and was kinda frustrated all morning.

Basically each time I use tried to log in, I get:

You do not have sufficient permissions to access this page.

I could not edit the blog, nothing works except the front page. I did a couple of searches at Google but the solutions didn’t seem to work for me.

In the end, I did a new installation of WordPress and scrutinized every damn thing in the users and usermeta table between a database that worked and a database that doesn’t.

Did you change the prefix of your table names in WordPress after the migration?

In my old database, I used ‘wp_’ as my prefix. As I migrated, I decide to use ‘wp3_’ instead of ‘wp_’. Unfortunately, the meta_key values are tied down to:

  • wp_user_level
  • wp_capabilities
  • wp_autosave_draft_ids

I need to update it to

  • wp3_user_level
  • wp3_capabilities
  • wp3_autosave_draft_ids

I wrote an SQL statement to share, just replace ‘prefix_’ with your new WordPress prefix. The following statements go to ‘meta_key’ and does a string replace from ‘wp_’ to ‘prefix_’.

UPDATE `prefix_usermeta` SET `meta_key` = REPLACE( `meta_key` , 'wp_', 'prefix_' );

(Make sure you do backups first! Note that the quotes used for string and field name are different.)

In the options table, there is ‘wp_user_roles’, make sure you get that changed into ‘prefix_user_roles’.

UPDATE `prefix_options` SET `option_name` = 'prefix_user_roles' WHERE `option_name` ='wp_user_roles' AND `blog_id` =0;

(Make sure you do backups first! Note that the quotes used for string and field name are different.)

With everything set, I tried logging in again and it worked. A happy WordPress user once again. I am using WordPress 2.2.2 before the migration and I did not upgrade WordPress during the migration. Hope it helps. (Applies to WordPress 2.3.3 also.)

Tags: , , ,

25 comments for “How to solve ‘You do not have sufficient permissions to access this page.’ in WordPress”

  1. Awesome fix you posted! With your clear instructions, I had it corrected in under 2 min. Thanks again.

    by dealasite (Aug 29, 2007 at 11 PM)
  2. You’re most welcome! Glad it helped. :D

    by Mr. Dew (Aug 30, 2007 at 2 AM)
  3. Thank you very much for yout tip. It saved me hours.
    Regards.

    by François-Xavier Bodin (Oct 4, 2007 at 6 PM)
  4. Wow - I was having exactly the same problem. This solved it! Thanks a bunch!

    by Arjun Prabhu (Oct 5, 2007 at 5 AM)
  5. Thanks for posting this information. I moved my Wordpress database and changed the prefix; the prefix thing is what got me. You saved me potentially hours of working trying to find the cause of my problem. Thanks again!

    by Brian Jarrett (Nov 5, 2007 at 5 AM)
  6. Thanks - saved me ages!

    by Julian (Feb 7, 2008 at 7 PM)
  7. [...] How to solve ‘You do not have sufficient permissions to access this page.’ in WordPr…If you rename the datbase table prefixes on an existing installation you will get bitten bu this. Simple fix takes a couple of minutes. wordpress howto [...]

    by Synesthesia » Links roundup for 2008-02-07 (Feb 8, 2008 at 8 AM)
  8. thanks a lot!!!!

    by piko (Feb 20, 2008 at 7 AM)
  9. ditto to all of the above. the admin for my Volleyball news site is now open for business once again - thanks to your tips.

    cheers
    Paul

    by Paul (Mar 3, 2008 at 10 AM)
  10. I owe you a beer! Thanks :)

    by Jacob Friis Saxberg (Mar 24, 2008 at 9 PM)
  11. Thanks for the help. Is there anywhere online where this design decision is explained? Is there a bug filed in Trac for this issue?

    by The Plaid Cow (Apr 3, 2008 at 12 PM)
  12. That was great info!

    I also found such records in the wp_options table as well, when trying to migrate, so whoever reads this be careful and look twice.

    by Takis (Apr 5, 2008 at 12 AM)
  13. Thanks for this info. Saved me a hard night of headaches. I was migrating one of my ebay wp sites into a new db. Glad I came across this.

    Big Mahalos to you!

    by chris (Apr 14, 2008 at 12 PM)
  14. Thanks this worked great.. thank god for Google and your blog post. :)

    Oliver Antosch
    from http://www.chinese-course.com/

    by Oliver (Apr 20, 2008 at 4 PM)
  15. nicely done, nicely done

    by WOOHOOO!!! (Apr 26, 2008 at 10 AM)
  16. Thank-you for posting this, it just saved me hours of head scratching!

    by Thomas M (May 2, 2008 at 12 AM)
  17. wow, thanks a lot! :)

    by andrea (May 3, 2008 at 3 AM)
  18. Thanks, your post saved me from getting a few more grey hairs.

    by David Valentiate (May 9, 2008 at 1 AM)
  19. thanks !! i was wondering how to get out of this mess myself..

    cheers,
    tom

    by tom (May 16, 2008 at 2 PM)
  20. fwiw, i tried both this approach and also mark’s approach (link above my comment) and neither worked. I finally imported the old version of my database and while the table names stayed the new name, I am now finally able to access admin functions! YEAH!

    by kathy (Jun 10, 2008 at 11 AM)
  21. Yeah, this doesn’t work for me either. Looks like it no longer works with current WP installations (2.5.1).

    by anysia (Jun 17, 2008 at 4 AM)
  22. I love you! I love you i love you i love you! It’s 5 am here and I’ve been panicking since I saw that error and google wasn’t helping then I saw this! I’m so glad you decided to share this, thank you so much.

    by Seluna (Jun 19, 2008 at 5 AM)
  23. Thanks, it’s work for me.
    I use this method directly with phpmyadmin and nothing difficult to do that.
    Thanks a lot.

    by lutfi (Jun 23, 2008 at 2 AM)
  24. Thank you, thank you, thank you!!!
    I spent AGES today trying to work this out - thanks!!!!!

    by Lorraine (Jun 25, 2008 at 8 AM)
 

Leave a Reply

 

Comments may be moderated due to spam. No advertisements are allowed in comments.

You'll require some math knowledge to comment, this is done to stop evil bots from spamming my blog.

Read my comments policy

Want a display picture?