“You do not have sufficient permissions to access this page” after database prefix change


After several times moving WordPress websites from one host to another, I get this painfully permission denied for superadmin user “You do not have sufficient permissions to access this page”. The frontend page was all fine. But I can’t access the admin page. Then I found these people who have the same problem and found the solution (http://wordpress.org/support/topic/sudden-you-do-not-have-sufficient-permissions-to-access-this-page-error).

The main cause is the database prefix changes. It cause the wordpress doesn’t recognize the admininstrator privilege. if you look into the wp_options table, the option_name from roles is wp_user_roles. The wp_ should match the table prefix. So if you change the wp_options table to en_options, then you must change the options_name to en_user_roles. That’s how the wordpress recognize the roles.

Besides that, user to role mapping also use the table prefix. You can see it in wp_usermeta tables. There is a meta_key called wp_capabilities. The wp_ is the table prefix of the wordpress tables. So if you change the table prefix e.q. wp_usermeta to en_usermeta, then you should change the wp_capabilities to en_capabilities.

Thats how you fix the permission problem to wp_admin page.

Have a good day

Tags: , ,

12 responses to ““You do not have sufficient permissions to access this page” after database prefix change”

  1. Gyp the Cat says :

    Thanks, you saved me pulling my hair out 🙂

  2. angiebee2 says :

    I’m having problems with only the “user” getting this error message after loggin in. Can you tell me do I change the same things or something else.

  3. ersanseer says :

    Thank you so much Eric. I, too, retain a full head of hair.

  4. gheuntak says :

    Thanks a ton buddy! this solved my problem

  5. lonasset says :

    It took me a while to figure out what table, fields and values, but it all works. I create screen caps for future troubleshooting and documentation. Thank you so much.

  6. Sms Women's Health (@Sms_Health) says :

    Ohh.. Thanks a lot for this. I moved my wp site to a new host, then I got this permission error. It was a total headache, searched many articles. At last now I’m fixed it, thank you so much…. 🙂

  7. 256Studio says :

    I was trying to add the Google Plus Authorship plug in and I got the “You do not have sufficient permissions to access this page” !
    I found that there was an issue with Google Analytics for WordPress plugin. Once I manually set the Google Analytics code. I no longer have this issue showing up.

  8. manish says :

    Thanks….I was just looking for wp_user_roles

  9. Toshiba-3 says :

    Ha! Helpful article, thanks a lot 🙂

  10. Kenneth P Nielsen says :

    Thanks to your article I managed to create a complete copy of our WordPress installation to use as test-environment – thank you!

Leave a reply to conorrobotham Cancel reply