When attempting to login to WordPress administration backend through /wp-admin/, you may encounter login failure issue with the following error message, despite the front-end (web pages) is working properly.

You do not have sufficient permissions to access this page.

WordPress Login Error

The error normally happens when webmaster or administrator changes the database table prefix ($table_prefix) used by WordPress in wp-config.php. Even though the prefix of database tables has also been changed correctly, but the error still happens. Besides, the issue may happens when attempting to link and connect a new WordPress installation to an existing database, or after editing the database manually via CLI or phpMyAdmin.

The cause for the “you do not have sufficient permissions to access this page” can be due to either database corruption, or more commonly, the change of prefix which is not done properly or completely.

WordPress uses the $table_prefix variable to form not just the name of the database tables, but also the name of the some options and usermeta keys which store and define user roles and capabilities. So if you have encountered the above error message after changing the DB table prefix, it’s most likely caused by the fact that several options and meta keys are still using the old prefix and not changed yet.

The solution is pretty simple. Logon and select the the WordPress database through phpMyAdmin or MySQL Command Line Tool, and then execute the following SQL commands:

UPDATE `{%TABLE_PREFIX%}usermeta` 
SET `meta_key` = replace(`meta_key`, '{%OLD_TABLE_PREFIX%}', 

SET `option_name` = replace(`option_name`, '{%OLD_TABLE_PREFIX%}', 

Replace {%TABLE_PREFIX%} with the current $table_prefix in used as defined in wp-config.php. In most cases, it should be the same with {%NEW_TABLE_PREFIX%}.

Replace {%OLD_TABLE_PREFIX%} with the previous $table_prefix.

Replace {%NEW_TABLE_PREFIX%} with the current $table_prefix.

If the old $table_prefix is ‘wp_’ and the new $table_prefix is ‘mdl_’, then the SQL queries will look like:

UPDATE `mdl_usermeta` 
SET `meta_key` = replace(`meta_key`, 'wp_', 'mdl_');

UPDATE `mdl_options` 
SET `option_name` = replace(`option_name`, 'wp_', 'mdl_');

Lastly, also check the database for any possible database corruption. The main culprit that is related to the WordPress wp-admin back-end is the values for {%TABLE_PREFIX%}capabilities and {%TABLE_PREFIX%}user_level that are linked to your user account.

In the database, look for the following meta keys in {%TABLE_PREFIX%}usermeta table:


Note that the table may contains more than one row for each of the meta keys above, as each user in WordPress has own values defined. Look for the one which has the user_id linked to your user account, which can be retrieved from {%TABLE_PREFIX%}users table.

The {%TABLE_PREFIX%}capabilities should have a value similar to a:1:{s:13:"administrator";b:1;}, and {%TABLE_PREFIX%}user_level should have a value of 10. Note that the quotations mark should be a straight quotation marks (dumb quotes) and not curly quotes.