php - Wordpress dashboard : "Sorry you are not allowed to access this page" after moving live website to localhost
I tried to backup my Wordpress website manually.
- I did a backup of my htdocs folder.
- I exported a .sql file backup of my database which has "mas" as a prefix. (no underscore after)
- I updated the old URL for the new URL in all my database (using PowerShell).
- I updated the wp-config.php file.
- I created a new database with the same name on my localhost server.
- I imported the .sql file on PhpMyAdmin.
After that, I realized I could not access the dashboard as an administrator.
I had the following message : D?�sol?�, vous n??�avez pas l??�autorisation d??�acc?�der ?� cette page.
Which is the French equivalent of : Sorry, you are not allowed to access this page.
So I deactivated all my plugins. I changed my .htaccess file for .htaccess.old .
In my database, my table usermeta is configured like this for my user account. For some reason, I have two times "prefix_capabilites" and "prefix_user_level" :
meta_key | meta_value |
---|---|
mascapabilites | a:1:{s:13:"administrator";b:1;} |
masuser_level | 10 |
wp_capabilities | a:1:{s:13:"administrator";b:1;} |
wp_user_level | 10 |
Answer
Solution:
You could try changing the wp_capalities
update wp_usermeta
set meta_value = 'a:1:{s:13:"administrator";s:1:"1";}'
where user_id = YOUR USER ID
and meta_key = 'wp_capabilities';
Otherwise you could consider a brand new wordpress install and migrate over using a plugin: https://wordpress.org/plugins/all-in-one-wp-migration/
Source