Plugins to change WordPress database prefix

Posted in Tutorials

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

Does your database table names look like this?  This show that the default database prefix of wp_ is being used.  If you did not specify a different database prefix during the installation of WordPress, this is what you get…

Not good to have this default db prefix

Not good to have this default db prefix

However, this is not so good because now hackers will know all your database table names.  Although they still have several obstacles to overcome, having predicable tablesname just makes it somewhat easier to hack .

It is better to have your database table names looking like this with obscure table name prefix …

good obscure database prefix

But how do you change the database prefix after you had already installed wordpress.  There is an option to specify it during installation of WordPress, but no option to change it afterwards.

Good thing there are plugins that would help to change the database prefix.  Certainly easier and safer to use a plugin than to manually copy the tables over to another table name and then change the wp-config.php file.

Of course you want to make a full database backup of your database first.

Changing the database prefix with “Change DB Prefix” Plugin

In this tutorial, we will look at two plugins that can do the job.  One such plugin is “Change DB Prefix Plugin”

1. Install and activate this WordPress plugin.  For the purpose of this tutorial, we are working with WordPress 3.8.1 and Change DB Prefix plugin version 1.0.

2.  After installation and activation of the plugin, go to “Settings -> Change DB Prefix”.

3.  It shows your current database prefix.  Enter your desired new database prefix.

change db prefix

change db prefix

4.  In our example, we are changing from the default WordPress prefix of wp_ to wpexample_

5.  If all goes well it should give a confirmation message that all tables have been successfully updated and the wp-config file has been updated.

Changing database prefix with Better WP Security Plugin

Better WP Security does many things related to security.  One of which is to change the database prefix.

Here is how to use that option.

1. After installation of the plugin, go to Security menu in WordPress dashboard.

security menu

security menu

Before you can do anything , the plugin will prompt you to backup your database.  I prefer to backup the database myself, rather than clicking that backup button shown above which would potentially email you a large backkup file.

Assuming that you already have a backup,  click the “No, thanks. I already have a backup” button.

2. Select the Prefix tab…

change database prefix tab

change database prefix tab

3. Click the “Change Database Table Prefix” button.  You don’t get to select your database prefix; it will randomly generate one for you which it will display for you at the bottom of the page saying “Your current database tabel prefix is t3b6x723f_”

You can always click the button again to re-generate a different prefix.

This tutorial was based on WordPress 3.8.1 and Better WP Security plugin version 3.6.3