1

I have a WP 4.6 site with an admin user which is unable to access /wp-admin, receiving the error (on a white screen):

Sorry, you are not allowed to access this page.

I had uploaded a designer's full site SQL export into phpMyAdmin (after find and replacing the host name from old to new).

I had also edited the designer's admin user account in phpMyAdmin to change the username, password, and email to my details.

After I did that is when I received the error above.

If I create a new user account following the instructions here:

Insert into wp_users:
ID – pick a number (in our example, we will use the number 4).
user_login – insert the username you want to use to access the WordPress Dashboard.
user_pass – add a password for this username. Make sure to select MD5 in the functions menu (Refer to the screenshot below).
user_nicename – put a nickname or something else that you would like to refer yourself as.
user_email – add the email you want to associate with this account.
user_url – this would be the url to your website.
user_registered – select the date/time for when this user is registered.
user_status – set this to 0.

Next we are going to have to add the values to wp_usermeta table:
umeta_id – leave this blank (it will be auto-generated)
user_id – this will be the id of the user you created in the previous step. Remember we picked 4.
meta_key – this should be wp_capabilities
meta_value – insert this: a:1:{s:13:"administrator";s:1:"1";}
Insert another row with the following information:
unmeta_id – leave this blank (it will be auto-generated)
user_id – this will be the id of the user you created in the previous step. Remember we picked 4.
meta_key – this should be wp_user_level
meta_value – 10

I receive the same symptom.

If I upload a fresh copy of WP 4.6 I have downloaded from Wordpress.org, the issue remains.

If I clear my browser cache the issue remains.

If I rename /wp-content/plugins to /wp-content/plugins.old, the issue remains.

Is the method listed here the correct method for adding a new admin user in phpMyAdmin?

If I change wp_capabilities for either the original or new admin user from a:1:{s:13:”administrator”;s:1:”1″;} to a:1:{s:13:”administrator”;b:1;} as suggested by a comment at the above URL, the issue remains.

Help appreciated.

1

I think the issue is to do with the values that you have stored in the database. Did you type it in or copy and paste? This could of led to unwanted white-space in the values stored in the DB.

Also curious as to why its being done at DB level when you can log into WordPress and do an import of a DB CSV file. This will import any blog posts, content, imagery stored there as well as other users. The reason I say this, is because it appears to be a new site setup rather than actually having to setup a new admin because of a hack (as alluded to why you would have to do it this way in the help article you linked to.)

I feel that in order to fix this issue, you are going to have to set up a new installation of WordPress with a fresh DB and start again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.