Solution for You do not have sufficient permissions to access this page WordPress Error
The WordPress error You do not have sufficient permissions to access this page is typically encountered when trying to access the WordPress dashboard or admin pages after you have changed the WordPress database table prefix, or moved WordPress from one hosting provider to another, or just upgraded your WordPress.
To fix this problem and regain access to the WordPress dashboard you have to manually change some entries from the table wp_usermeta in the WordPress MySQL database. In this WordPress tutorial we will explain which entries should be changed and how to change them using the phpMyAdmin or MySQL commands.
Change Records from wp_usermeta Table using phpMyAdmin
- Login to your hosting provider CPanel and launch phpMyAdmin which can be found in the Databases section as seen in the below screenshot.
- Once logged in to PHPMyAdmin, select the WordPress MySQL database. If you have multiple databases and not sure which is the WordPress database, you can find the name of the database from the WordPress wp-config.php file, e.g. define(‘DB_NAME’, ‘wpdb’).
- Once the WordPress database is selected a list of all the tables in the database is populated as seen in the below screenshot. Click on the table wp_usermeta to access its content. The default WordPress table prefix is wp therefore if you just changed the prefix to e.g. Kyp51, the table name will be Kyp51_usermeta.
- Once the list of user options is loaded, change the prefix of the following entries in the meta_key column for the administrator username to match the prefix you have configured in your WordPress wp-config.php file. If you have multiple WordPress users, you might need to change the below list of entries for each and every WordPress user.
Example: if the current WordPress database table prefix is Kyp51, the entries should be renamed to:
WP White Security Tips:
- Ensure that the CaPiTaLiZatIoN of the prefix matches that of the prefix for all database tables.
- If you installed third party plugins or themes that add entries to this table you might need to change their prefix as well. In this example we used a default WordPress installation database.
Once the above database records from the wp_usermeta table have been renamed, you should be able to login to the WordPress dashboard.
Change Records from wp_usermeta Table using MySQL Commands
- Login to MySQL using the below command and once prompted specify the root password:
mysql –host localhost –u root -p
- Select the WordPress database using the below command. In our example, the WordPress MySQL database is called wpdb:
- Run the following MYSQL commands to rename the prefix of the rows mentioned in step 4 of the above guide. In our example we are renaming the prefix to Kyp51.
UPDATE `wpdb`.`wp_usermeta` SET `meta_key` = 'Kyp51_capabilities' WHERE `wp_usermeta`.`umeta_id` =10; UPDATE `wpdb`.`wp_usermeta` SET `meta_key` = 'Kyp51_user_level' WHERE `wp_usermeta`.`umeta_id` =11; UPDATE `wpdb`.`wp_usermeta` SET `meta_key` = 'Kyp51_user-settings' WHERE `wp_usermeta`.`umeta_id` =14; UPDATE `wpdb`.`wp_usermeta` SET `meta_key` = 'Kyp51_user-settings-time' WHERE `wp_usermeta`.`umeta_id` =15; UPDATE `wpdb`.`wp_usermeta` SET `meta_key` = 'Kyp51_dashboard_quick_press_last_post_id' WHERE `wp_usermeta`.`umeta_id` =16;
A default WordPress installation was used in the above example. In a real live WordPress installation the umeta_id number of the rows you would like to change might be different. It is recommended to check the value of every row before renaming it by using the below command. Change the umeta_id value to match the row you would like to check:
select * from wp_usermeta where umeta_id=10;
Once the above records from the wp_usermeta table have been renamed, you should be able to login to the WordPress dashboard.