In one of my earlier post I have mentioned that it is good to change the wordpress database prefix to secure your wordpress installation.
By default wordpress database tables have wp_ prefix. But it is recommended to change this prefix other word, just for an example: dfdh45_.
Main benefit for this way is no one can guess your database table names. :)
You can change this prefix while installing the wordpress. But if you have not changed and want to change the prefix to make your site secure then you are at correct place now.
This article is about to explain “How to change WordPress database Prefix for Existing site”. This process will be covered in 4 easy steps. You should be somewhat familiar with the SQL for this process.
Make sure you backup your database before executing any of the below steps. Because that will be useful if you fail at any step in this process.
First and very easy step to edit your wordpress config file (wp-config.php) which should be at root directory of the site.
You need to change the value of the database prefix variable, for now it will be wp_ and you have to change it with anything else which is hard to guess, for example fdgd3s_.
Now its time to rename all your tables. If you have not installed any plugins which creates own tables then you just have to rename default wordpess tables. You need to perform below queries.
WordPress stores few table name in two tables. So we have to update those rows with the new database prefix. Just have a look at below for which tables to update.
First need to edit one row from the wp_option table which is now fdgd3s_options. Execute below query in database and you will get one row with old database prefix in option_name fields. Edit this row with the new database prefix.
Above step must be completed otherwise you will not be able to login to your wordpress backend.
Now perform below query in user_meta table, You will find few rows which you also needs to update new database prefix.
Update all fetched rows with the new table prefix.
Yes you are done with this process. Now your wordpress tables are now more secure than earlier. Make sure you are able to login to back end.
If you do not have custom table prefix then its recommended to change the database prefix which makes you more secure than before. Your thought on this?
Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.
View all posts by: Avinash