How to change WordPress database prefix
It is easy to setup the database prefix when you first install WordPress. The default prefix is wp_
![Not good to have this default db prefix](http://learnwebtutorials.com/wp-content/uploads/2014/02/default-db-prefix.jpg)
Not good to have this default db prefix
However, it is best practice to not use the default prefix so as to make it more difficult for hackers to attack the database.
What happens if you had installed your WordPress with the default wp_ database prefix and now you want to change it to make things more secure. This becomes a bit more difficult as you don’t want to delete and re-install WordPress. But fortunately, there are plugins that would help do change the database prefix.
The easiest (and arguably the safest) way to change the database table prefix is to let a plugin do it for you. But before you do anything else, even before you install the plugin, you need to backup your database.
First and most important thing you want to do is to make a full database backup of your WordPress database. Remember the plugin is making changes to the database. If something goes wrong, records in database can get corrupted rendering your site unusable. Okay, so now let’s assume that you have backed up your database.
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. If you are not familiar with installing WordPress plugins, read this tutorial.
2. Go to “Settings -> Change DB Prefix” …
![change database prefix](http://learnwebtutorials.com/wp-content/uploads/2014/02/change-db-prefix.jpg)
change database prefix
Here we are changing the default wp_ prefix to something more complex (such as wpexample_)
If all goes well, you should get the confirmation message …
All tables have been successfully updated with prefix wpexample_ !
The wp-config file has been successfully updated with prefix wpexample_!
This was tested on WordPress 3.8.1 and Change DB Prefix plugin version 1.0)
Changing database prefix with Better WP Security Plugin
Another plugin is Better WP Security plugin. Better WP Security does many other things to secure your WordPress and one of which is to change the database prefix.
Here are the steps for how to use this plugin to change database prefix.
1. After installation of Better WP Security, go to settings in the Security menu.
![security menu](http://learnwebtutorials.com/wp-content/uploads/2014/02/security-menu.jpg)
security menu
You will be taken to the Dashboard of the Better WP Security plugin. If this is the first install of the plugin, you will be asked to backup the database. If you click the “Create Database backup”, it will email you the backup file which could be very large (too large for me to receive in my email). Since we had already created our own backup as mentioned previously, we can click the “No, thanks. I already have a backup” button.
2. Click the Prefix tab, or alternatively you can select “Database Prefix” in the left side menu.
![change database prefix tab](http://learnwebtutorials.com/wp-content/uploads/2014/02/change-database-prefix-tab.jpg)
change database prefix tab
3. Click the “Change Database Table Prefix” button. You get the status message “Database Prefix Changed”. It will be changed to a random unique prefix which it will display for you at the bottom of the page saying “Your current database tabel prefix is t3b6x723f_”
If you look at your database, you can confirm that the prefix has indeed changed to a good obscure database prefix…
![good obscure database prefix](http://learnwebtutorials.com/wp-content/uploads/2014/02/good-obscure-database-prefix.jpg)
good obscure database prefix
If you don’t like this prefix for some reason, you can click the button again to generate a different prefix.
(This was tested on WordPress 3.8.1 and Better WP Security plugin version 3.6.3)
If you no longer need these plugins after they have done the database prefix rename, you can now remove the plugin as it is no longer required.