How and Why to Rename WordPress Database Tables

hedgehog-mascot

When moving to a new hosting provider, specific settings at your new hosting provider can make or break your site. A good example of this is the naming convention your hosting provider uses for its database tables. To make things work, it might be necessary to rename WordPress database tables.

In most cases, all WordPress database tables begin with the wp_ prefix. However, some companies (such as GoDaddy) in an attempt to add an extra layer of security to your WordPress installation, create individual prefixes for each and every WordPress installation.

So, instead of having a database table called wp_users, at GoDaddy you will end up with a database table called something like wp_darvb96syk_users. The additional character string is randomly generated.

What will you learn in this post?

I will show you how to:

  • resolve the ‘You don’t have sufficient permissions to access this page’ error in WordPress
  • rename WordPress database tables by using an SQL query
  • rename keys within your database tables manually or by using an SQL query
  • change the table prefix variable for your entire WordPress installation

The Problem of Insufficient Permissions

Problems arise when you don’t know about this peculiarity and attempt to move your existing WordPress installation, which uses the standard naming for its database tables, to a database newly created by GoDaddy.

What you end up seeing is this error:

You do not have sufficient permissions to access this page

You do not have sufficient permissions to access this page

You won’t be able to see any of your existing content. And you won’t even be able to log in to your WordPress Dashboard.

Rename WordPress Database Tables

To make this error message go away and gain access to your site’s content, you need to rename WordPress database tables, which GoDaddy generated, to the ones you used at your previous hosting provider.

In other words, you need to use the standard naming convention for your database tables.

To do this, access your WordPress SQL database via phpMyAdmin.

Inside phpMyAdmin, click on the name of your database in the left pane and then click on the SQL button in the right pane.

Next, copy and paste the following query in the Run SQL query/queries window:

Then click on the Go button to execute the query.

This is how the visual layout of phpMyAdmin will look like:

phpMyAdmin — Rename tables

phpMyAdmin — Rename tables

There might be other tables present in your database, depending on the themes and plugins you use in your specific WordPress installation.

If you have extra tables, make sure that you include those in the above SQL query, too.

You need to rename all your tables to their correct names.

User Roles and Capabilities

There are two other key things that you must rename in your database.

Find the wp_darvb96syk_user_roles option name in the wp_options table and rename it to wp_user_roles.

And find the wp_darvb96syk_capabilities meta key in the wp_usermeta table and rename it to wp_capabilities.

You can either find them manually, click the Edit link next to them and rewrite their names.

Or you can use the following SQL queries to rename them:

and

Important Note

In all of the above cases, you need to replace the darvb96syk_ prefix with the random prefix you have been generated.

Change Table Prefix in wp-config.php

And the last piece of the puzzle is changing the database table prefix variable in the wp-config.php file located in the root folder of your hosting server.

Access your server via FTP using WinSCP. You will need the account access name and password your hosting provider gave you when you first set up your hosting with them.

Make sure that the $table_prefix variable contains the wp_ prefix:

Conclusion

Unless you make all these changes, you will get a “You do not have sufficient permissions to access this page.” and you won’t be able to use your site’s front end (publicly visible content) or back end (WordPress Dashboard) in any way whatsoever.

Liked this post?

Subscribe to our newsletter to receive early notification of new posts and deals:

Next Post »« Previous Post

Leave a Reply

Your email address will not be published. Required fields are marked *