The WordPress error “You do not have sufficient permissions to access this page” is usually encountered when trying to access the WordPress dashboard or admin pages after changing the database table prefix WordPress data or moved WordPress from a provideraccommodation to another, or simply updated your WordPress installation.

To solve this problem and regain access to the WordPress dashboard, you must manually change some entries in the table " wp_usermeta in the WordPress MySQL database. In this WordPress tutorial, we will explain which entries need to be changed and how to change them using phpMyAdmin or MySQL commands.

How to edit entries on wp_usermeta

1 - Log into your CPanel and launch phpMyAdmin which is located in the Databases section as shown in the screenshot below.

mysql cpanel

2 – Once connected to PHPMyAdmin, select the MySQL database that corresponds to that of your WordPress blog. If you have multiple databases and you don't know which is the WordPress database, you can find the database name from the WordPress file "wp-config.php", at the line where is the code " define ('DB_NAME', 'wpdb') ».

Once the WordPress database is selected, a list of all tables in the database is displayed as shown in the screenshot below. Click on the "wp_usermeta" table to access its content. The default WordPress table prefix is ​​"wp" so if you just changed the prefix, for example to "Kyp51", the table name will be "Kyp51_usermeta".

Access the wp usermeta table

4 - Once the list of user options is loaded, change the prefix of the following entries in the "meta_key" column so that the administrator username matches the prefix you configured in your WordPress wp-config file .php. If you have multiple WordPress users, you may need to edit the entry list below for each WordPress user.

  • Wp_capabilities
  • Wp_user_level
  • Wp_user-settings
  • Wp_user-settings-time
  • Wp_dashboard_quick_press_last_post_id

Editing wordpress tables

Example: If the current prefix of the WordPress database table is Kyp51, the entries must be renamed:

  • Kyp51_capabilities
  • Kyp51_user_level
  • Kyp51_user-settings
  • Kyp51_user-settings-time
  • Kyp51_dashboard_quick_press_last_post_id

Some security tips:

Make sure that the "CaPiTaLiZatIoN" of the prefix matches that of the prefix for all tables in the database.

If you have installed any third-party plugins or themes that add entries to this table, you may also need to change their prefix. In this example, we used a default WordPress installation database.

Once the database records above on the wp_usermeta table have been renamed, you should be able to connect to the WordPress dashboard.

How to edit records from MySQL

1 - Log into MySQL using the command below and, when asked, specify the user's password:

mysql -host localhost -u root -p

2 - Select the WordPress database using the command below. In our example, the WordPress MySQL database is called "wpdb":

Use wpdb

3 - Execute the following MYSQL commands to rename the prefix of the lines mentioned in step 4 of the guide above. In our example, we rename it to the prefix of 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 example above. In a real live WordPress installation, the number of "umeta_id" lines you want to change may be different. It is recommended to check the value of each row before renaming it using the command below. Change the umeta_id value to match the row you want 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 connect to the WordPress dashboard.

That's it for this tutorial, I hope it will allow you to connect to your WordPress dashboard.