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

Possibly related:

  1. WordPress 2.3.2 released!
  2. find//replace
  3. point//three

Tags: , , ,

131 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)
  25. Saved me some headache, thanks for the great post.

    by zer0day (Jul 25, 2008 at 4 AM)
  26. did wordpress developers remove the prefix embedding from the table values in 2.5+? or are they continuing to keep wordpress as fucked as it always has been for every-13th-weekend warriors?

    by blow bird (Jul 31, 2008 at 3 PM)
  27. Just what I needed to fix my blog, thanks for the tips.

    by Adam Backstrom (Aug 7, 2008 at 1 AM)
  28. Thanks for the tips, so I could fix it in 5 minutes.

    But I used navicat for mac. Just get into the tables and changed the prefix in the 4 fields. No need to write sql statements.

    by filmbox (Aug 12, 2008 at 8 PM)
  29. I did the SQL here — and the force-upgrade.php from http://markjaquith.wordpress.com/2006/03/28/wordpress-error-you-do-not-have-sufficient-permissions-to-access-this-page/ — and was still having problems.

    Then I decided to look carefully at the prefix_usermeta database table, where I discovered that there were two records for prefix_capabilities. One had ‘administrator,’ the other ‘editor.’ I deleted the one with ‘editor.’ That finally fixed the problem.

    I’m not sure why there should have been two prefix_capabilities records. I wonder, however, if either the update process itself or force-upgrade.php may have inserted the additional record when it found no appropriate one because of the old prefix on the capabilities record…

    I suspect that all of the above was necessary for me. Perhaps it could possibly happen to someone else, also. Therefore this post.

    by Mike Green (Aug 16, 2008 at 4 AM)
  30. Very nice. Thanks :-)

    by kimalders (Aug 18, 2008 at 2 PM)
  31. will it work for 2.6 too :(

    by chandan (Aug 18, 2008 at 9 PM)
  32. I had the same problem. My solution was to re-edit the SECRET KEY section of the wp-config.php.

    You will need to put the SECRET KEY code above this line in wp-config.php

    /* That’s all, stop editing! Happy blogging. */

    by AW (Sep 14, 2008 at 9 AM)
  33. Thank you very much, I was installing a new plugin and had to migrate an existing blog into the new tables and was giving me many problems. This was the last problem and was about to give up – thanks!

    by Kerry (Sep 18, 2008 at 1 PM)
  34. thanks, this tip helped.

    by Joe (Sep 19, 2008 at 12 AM)
  35. A problem we hadn’t dealt with before, this was a very useful guide!

    by Dave (Sep 20, 2008 at 9 PM)
  36. Thank you so much, I’ve solved my issue.

    by California SR22 (Sep 21, 2008 at 10 AM)
  37. Thanks much for figuring this out!

    by Charlie R (Sep 25, 2008 at 2 AM)
  38. Just saved me from hours of troubleshooting!

    Thanks a bunch! :D

    by timkl (Oct 2, 2008 at 7 PM)
  39. Brilliant. Thanks for this info. Worked flawlessly.

    by Aaron forgue (Oct 14, 2008 at 11 PM)
  40. I still can’t get it to work, after adding Secret key, changing prefixes in all the db’s… This is wearing me down…

    by sven (Oct 17, 2008 at 7 PM)
  41. Thanks. It works for me.

    by Steve (Oct 24, 2008 at 4 PM)
  42. Just fixed my 2.6.2 version with your tips… this would have been a real bear to track down without your help. Much appreciated.

    by Ron Amundson (Oct 26, 2008 at 11 PM)
  43. is it possible to move multiple wordpress into one database and have different prefixes for each site?

    by Barry Main (Oct 28, 2008 at 11 PM)
  44. A great post, I don’t know a great deal about sql but this really helped me transfer my wordpress site in no time.

    Many thanks for the instructions

    by Water (Nov 2, 2008 at 11 PM)
  45. Thanks a bunch! You saved my bacon.

    by Mark (Nov 21, 2008 at 10 AM)
  46. This worked perfectly for us, well done.

    by Packyourbags (Dec 4, 2008 at 2 PM)
  47. Dear Mr. Dew you can add me to the list of fellows that owe you one for this post. If you come to Montreal, Quebec, please contact me and I’ll be glad to take you for a free lunch.

    by Christian Aubry (Dec 13, 2008 at 12 PM)
  48. Woo hoo! Thanks SO much for writing this out. I had the same problem and this fixed it up in a jiffy!

    by weave (Dec 19, 2008 at 8 AM)
  49. Thanks dear…..
    I owe you big time….
    Thanks again….

    by Nikhil Gupta (Dec 22, 2008 at 8 PM)
  50. Thanks man! If you’re in South Florida, I will take you out for a beer or three!

    by Otavio Fonseca (Dec 25, 2008 at 9 AM)
  51. Thanks
    you’re a timesaver !

    by Kristof (Dec 27, 2008 at 10 PM)
  52. Thanks! Saved me some pain too :)

    by Boris (Jan 4, 2009 at 9 PM)
  53. Thank You, Thank You, Thank You!

    I was about ready to pull my hair out on this one!!! Thanks for providing all the details! Especially the fact that you also need to update the wp_options table and change the “wp_user_roles” option_name to match your new prefix_…!

    Thank You, Thank You, Thank You!!!!!!!!!!!!!!!!!

    by DPC (Jan 26, 2009 at 12 PM)
  54. Thank you! Also working in WP 2.7!

    by Daniel (Jan 28, 2009 at 4 AM)
  55. Was doing some real complicated backup and recovery stuff and this one was a real blow… thanks a ton for your post it got my sunken ship sailing again :)

    by Sanjay M (Feb 8, 2009 at 2 AM)
  56. Thanks for the write-up. Had an oooold WP site to sort out that was doing this because of a migration. Saved me working out how to fix it. Well done.

    by David Coveney (Feb 10, 2009 at 12 AM)
  57. This didn’t fix my frontend – but it did fix my backend so I could export all my pages to an XML file!

    Much appreciated!

    by Ben (Feb 10, 2009 at 10 AM)
  58. I tried everything, then went to phpmyadmin went to the wp_table then wp_user roles opened that up and compared it with my other working blogs found a difference changed it and it worked!!!! ok in the text on the second line it should be a:53: INSTEAS of a:51: simple now everything works!!!!

    by Lambros (Feb 15, 2009 at 6 AM)
  59. This is what I did to convert “wb_” to “qb_”:

    RENAME TABLE wp_comments TO qb_comments;
    RENAME TABLE wp_links TO qb_links;
    RENAME TABLE wp_options TO qb_options;
    RENAME TABLE wp_postmeta TO qb_postmeta;
    RENAME TABLE wp_posts TO qb_posts;
    RENAME TABLE wp_terms TO qb_terms;
    RENAME TABLE wp_term_relationships TO qb_term_relationships;
    RENAME TABLE wp_term_taxonomy TO qb_term_taxonomy;
    RENAME TABLE wp_usermeta TO qb_usermeta;
    RENAME TABLE wp_users TO qb_users;
    RENAME TABLE wp_wp_bible TO qb_wp_bible;

    UPDATE `qb_usermeta` SET `meta_key` = REPLACE( `meta_key` , ‘wp_’, ‘qb_’ );

    UPDATE `qb_options` SET `option_name` = ‘qb_user_roles’ WHERE `option_name` =’wp_user_roles’ AND `blog_id` =0;

    by Joshua Szanto (Mar 7, 2009 at 6 AM)
  60. [...] Si como yo deciden cambiarle el prefijo a las tablas de su WordPress ya instalado: How to solve ‘You do not have sufficient permissions to access this page.’ in WordPress [...]

    by Dieresys » Blog Archive » Securizando WordPress (Mar 8, 2009 at 3 AM)
  61. As with the first post, a year and a half ago, this was an excellent post with clear instructions. Worked perfectly for WP 2.7.1 after I changed my table prefixes.

    by Gary (Mar 9, 2009 at 5 PM)
  62. Thank you for the post, it solved my problem too!

    by Istvan (Mar 15, 2009 at 8 AM)
  63. i have tried this — biut i am stil geting the error. it is only happening at 2.7,1

    by butter (Mar 21, 2009 at 2 AM)
  64. I figured I’d add to the pile of hundreds of developers thanking you: THANK YOU! This saved me hours. Kudos.

    by John Rockefeller (Mar 26, 2009 at 8 AM)
  65. You are a star, i have been banging my head against a wall for days now, your fix worked perfectly, thanks.

    by Norton (Mar 26, 2009 at 10 PM)
  66. You saved me from hours of work here MrDrew. Thanks alot for posting this!

    by nomark (Mar 27, 2009 at 4 AM)
  67. THANK YOU!! I was having puppies trying to figure this out. You rock!

    by Michelle (Apr 11, 2009 at 6 AM)
  68. Thanks it helped me a lot

    by Harsh Agrawal (Apr 14, 2009 at 4 PM)
  69. THank you..helped me out !

    by Shoaib (Apr 16, 2009 at 2 AM)
  70. [...] 这次搬家过程可谓是麻烦不断,先是mysql4-mysql5的编码问题折腾半天,之后又发现登录后台提示我‘You do not have sufficient permissions to access this page.’  直接扔到google里面立刻发现答案:原来问题在于我修改了wp数据库表明的前缀,除去修改wp-config.php文件外,数据库里面的部分数据也需要更新,文章作者也给出了sql语句,转载如下: [...]

    by 登录wordpress后台出现‘You do not have sufficient permissions to access this page.’的解决办法 at gkp’s post (Apr 20, 2009 at 3 PM)
  71. Thank you so much for this quick fix! I’m new to Wordpress and changed my table prefix since I read an article on Wordpress.com that might make the WP installation safer (security through obscurity thing). And the next thing it locks me out of the admin area…

    by Andrew (Apr 26, 2009 at 5 AM)
  72. thank you kindly sir! was pretty confused by this one and your solution worked perfectly. :)

    by matt mcinvale (Apr 28, 2009 at 1 AM)
  73. Thank you for your greate work!

    by Travor (May 13, 2009 at 10 AM)
  74. Thanks a lot! My issue is solved.

    I moved a friend’s blog to GoDaddy hosting. Before the move, I updated the SQL file as much as possible, but clearly these changes were unexpected.

    Now the blog is up and running again!

    by Rajib Ghosh (May 21, 2009 at 12 PM)
  75. [...] 带着问题google了一下,在这里发现了答案: How to solve ‘You do not have sufficient permissions to access this page.’ in WordPress [...]

    by 数据库表名错误导致无法访问blog - KangKang2 (Jun 6, 2009 at 11 PM)
  76. Excellent upgrading to 2.8 I decided to run the secure plugin and it knocked off admin – this solved it perfectly

    Many thanks

    by Mike (Jun 11, 2009 at 10 PM)
  77. Woo!! Thank you :)

    by Matt Rogowski (Jun 14, 2009 at 5 AM)
  78. Thanks for this fix! Seemed a bit strange to me that you have to do this by hand, but it was done quickly and worked like a charm.

    by Martin (Jun 14, 2009 at 4 PM)
  79. Thanks for posting this.
    That security plugin had locked me out.

    by radian (Jun 17, 2009 at 9 PM)
  80. I did the same as Mike above, thanks for posting this – great!

    by Neil (Jun 18, 2009 at 6 PM)
  81. Thanks a lot !! You saved my day so efficiently !! Thousand thanks ^^

    by David (Jun 26, 2009 at 5 PM)
  82. excellent thanks :)

    by limca (Jun 27, 2009 at 3 PM)
  83. Great! You save me some horribles and frustrating debugging hours !

    by kabye (Jul 4, 2009 at 10 PM)
  84. take my kiss…
    u save my ass…
    many thanks.

    by emonweb (Jul 9, 2009 at 7 PM)
  85. Another huge thanks! I was about ready to reinstall, when Google found this- still works with WP2.8.

    by Chris Bryant (Jul 9, 2009 at 9 PM)
  86. You just saved me from parsing through the whole prefix_options table. Awesome job!

    Thanks!

    by Ian Atkin (Jul 13, 2009 at 10 AM)
  87. Thanks, a couple of old prefixes were causing trouble when moving a WP 2.7 site – good tip.

    by Karl (Jul 16, 2009 at 5 PM)
  88. As everybody else above, I want to thank you for saving my day :)

    by BaroqueW (Jul 17, 2009 at 6 PM)
  89. Thanks, this just saved me a good few mins of time.

    by james (Jul 21, 2009 at 7 PM)
  90. Thax a lot. IOU a bear. You are the hero of myy day.

    by Peter Shaw (Jul 22, 2009 at 6 AM)
  91. Thanks, and confirming this fix works on wordpress v2.8.2

    by ZachWeg (Jul 23, 2009 at 5 AM)
  92. You absolute hero! mwah!

    by Jimmy (Jul 23, 2009 at 6 PM)
  93. Almost 2 years after you originally posted this, you’re still helping people out of that daunting “You do not have sufficient permissions” error message.

    Thanks for helping me out too!

    Cheers,
    - Lee

    by Lee Kelleher (Jul 24, 2009 at 6 AM)
  94. Thanks for this! Reinstalling would not have been an option for me.

    by Jens Walter (Jul 24, 2009 at 10 PM)
  95. WOW!!! Thank you very much for this one!! I was almost desperate, but this thing actually works! Thank you man!

    I build up a new database, imported the last export and then used the Query on top of this page… Voila, Bob’s your uncle!

    Greetings from Holland!

    by Frank (Aug 4, 2009 at 2 AM)
  96. [...] table prefixes which disallows you to login to your Dashboard. There’s a brilliant article here that helped me fix my [...]

    by WP Security Scanner plugin and Second IP Address! | The Eggshell (Aug 9, 2009 at 11 PM)
  97. Thank you very much for this!

    I had every part of your solution with the exception of updating the options table. You saved me a lot of time!

    by Jeremy (Aug 13, 2009 at 10 AM)
  98. Thanks very much :)

    by charlieb (Aug 15, 2009 at 1 AM)
  99. Thanks for posting this! Made for a quick fix to my issue.

    by Toluallii Nielsen (Aug 15, 2009 at 8 AM)
  100. If I ever meet you in person, remind me to buy you a beer!

    by crashsystems (Aug 18, 2009 at 11 AM)
  101. You rock guy!!!

    by Jonny (Aug 18, 2009 at 5 PM)
  102. Thanks so much! Although I had very recent backups, you saved me a lot of work and possible downtime.

    by David Di Gioia (Aug 22, 2009 at 9 AM)
  103. [...] lot of the info on the wordpress site doesn’t really cover this issue. Luckly, this does. Basically, you need to go into the “usermeta” table, and change the [...]

    by Everybody Staze… » Moving wordpress tables (Aug 23, 2009 at 10 AM)
  104. Worked like a charm for me with an upgrade to WP 2.8.4 and a change of prefix.

    Thank you so much!

    by David Hartley (Aug 23, 2009 at 11 PM)
  105. Great fix. Tango mike!

    by Anthony Burns (Aug 24, 2009 at 7 PM)
  106. Just ran into this very problem. Your fix worked great! Thank you!!

    by Jennifer (Aug 29, 2009 at 4 AM)
  107. Phew, thanks! Was getting a bit worried for a moment.

    by Robert Dyson (Aug 29, 2009 at 12 PM)
  108. [...] 可能的问题是 $_usermeta这个数据表中的数据问题:需要改成新的:老外解决方案 [...]

    by J.et wong’s stuff » wordpress 的移植出现的问题 (Aug 30, 2009 at 4 PM)
  109. thanks a lot. its save my time :)

    by coconut (Aug 30, 2009 at 7 PM)
  110. Thanks a lot from Finland! You saved my night. Now I can go to sleep. :)

    by Mikis (Aug 31, 2009 at 5 AM)
  111. Really, really helpful post. Thanks for writing these easy-to-follow instructions!

    by David Chambers (Sep 6, 2009 at 4 PM)
  112. You are a lifesaver…

    by Jake (Sep 9, 2009 at 10 PM)
  113. Thanks so much–years later, still very useful.

    by Josh (Sep 11, 2009 at 5 AM)
  114. You saved me quite a bit of work, thanks!

    by Anne (Sep 11, 2009 at 10 AM)
  115. Thanks for the help when trying to upgrade.

    You is da man

    Alex

    by Alex:: Home Life Weekly (Sep 13, 2009 at 6 AM)
  116. This post helped me too. Was cofused by the UPDATE queries at first. Thanks.

    by Slawa (Sep 14, 2009 at 5 PM)
  117. Brilliant! Worked perfectly on WordPress 2.8.4.

    by Mango (Sep 21, 2009 at 12 AM)
  118. Thanks.
    u saved my ass! :)

    by Murali Kumar (Sep 21, 2009 at 8 PM)
  119. It worked like a charm thanks a lot. This was the third or fourth post I read on this issue, until I found your solution.

    by trendmxseo (Sep 25, 2009 at 4 PM)
  120. thanks a lot, mate. saver!

    by Lima (Sep 25, 2009 at 9 PM)
  121. –Thanks! Been trying to rebuild my blog and this was a great help.

    by Tim C (Sep 29, 2009 at 8 AM)
  122. Thank you!!!
    Although, for WP 2.8.3 the second step could not be done. no wp_user_roles option name.
    Everything worked!!

    THANK YOU!!

    by odyodyodys (Oct 8, 2009 at 9 PM)
  123. Thanks! A new little thing to know about WP!

    by G100g (Oct 9, 2009 at 4 PM)
  124. thank you so much. this saved my day! :)

    many greetings from germany, and thanks again!

    by maery (Oct 12, 2009 at 2 AM)
  125. Thanks! Your simple sql script saved me.
    And also learned the hidden logic about table prefix. :D

    by slw4qd (Oct 16, 2009 at 1 PM)
  126. Thanks for taking the time to provide the SQL statements – not only did you tell us what the problem was, you gave us a quick and easy solution.

    by jack (Oct 22, 2009 at 12 PM)
  127. gee dude,
    thanks for that
    i was almost reinstalling!

    by brasofilo (Oct 22, 2009 at 4 PM)
 

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?