If you are on this page then you probably received a message during your restore that said your table prefix must be changed in order to restore your site. At this point you are probably wondering what a table prefix is and why you need to change it. Below we have outlined the steps necessary to change your table prefix.
Before proceeding with these steps it is important to understand that changing the table prefix will force WordPress to create all new database tables. This means that any content added prior to changing the prefix will no longer be available in your WordPress site. We only recommend changing the table prefix when attempting to restore, migrate or clone your site to a new host or WordPress install. Please feel free to contact us if you have any questions.
What is a table prefix?
The WordPress table prefix is a prefix value that is assigned to all the tables in your WordPress database. There are a few uses for this prefix, the first is to allow you to share a single database for multiple WordPress sites. The second is as an added security measure for your WordPress install. Out of the box WordPress uses 'wp_' as the default prefix but many security exports recommend you change this to something unique and hard to guess to make it more difficult for hackers to access your database.
At this point if you are wondering what your table prefix value might be then you are not alone because there are many ways the initial value can be set. Sometimes your hosting provider will prompt you to choose a unique prefix during your site install and sometimes your host will generate one for you. If you hired a WordPress consultant to create your site then it is possible this person setup your prefix. However, once the prefix is set and your site goes live, we do not recommend changing the table prefix unless you know what you are doing.
In the remainder of this post we will instruct you on how to setup the table prefix for your new site so that is matches the old site you are attempting to migrate or clone. This is important because the new sites prefix must match the old one in order to restore it on the new host.
Step 1 – Locating your WP-CONFIG.PHP file
Your table prefix is found in the main WordPress configuration file. This is a file named wp-config.php file and can be found in the root folder of every WordPress installation. This file contains many configuration options for WordPress but for now we will be focusing solely on the table prefix setting.
One of the simplest ways to access this file is by using your favorite ftp tool. Once you are connected to you site via ftp you will find the wp-config.php file in the root of your web site. Many ftp tools allow you to modify the file without downloading, editing and then uploading again. In the screenshot below you can see how I use FileZilla to find the wp-config.php in the root folder of my site. I then simply right click the file and select the “view/edit” option to modify the file.
In this example I am using an FTP tool because all hosting providers support FTP but keep in mind there may be other options depending on your host. Many hosts will allow you to view and edit files via an administration control panel like cpanel so feel free to use whatever tool you are most comfortable with.
Step 2 – Finding your Table Prefix
Once you have the file open for editing it will look something like the image below.
To locate the table prefix settings simply search for the word prefix using the search feature of your text editor. When you find the correct setting it should look similar to the image below. In this case the table prefix value is wp_ which is the value contained between single quotes.
This process will be the same for both viewing your live sites existing table prefix and for editing your new sites prefix. To edit this value simply change the prefix(the value between the single quotes) to match your existing live site and save the document.
Please note that you should ONLY change this value for your NEW site, not your existing site. When this value is saved and uploaded, WordPress will recognize the new values and recreate all your database tables with the new prefix.
Don’t worry, the old tables will still be available but WordPress will no longer use them for your site. When this is done correctly WordPress will prompt you to setup a new site as seen in the image below.
Now that you have changed your new sites prefix you will be able to move forward with restoring, migrating/cloning your site.
Please note that you may need to install or activate WP BackItUp again because WordPress has created a new database for you with all your new table prefixes. When this happens any content that was added to the site previously will no longer be available. However, any media files or backup files should still exist and be available.