Back to Top

How To Change Database PREFIX in WordPress

Basically, WordPress had a default database prefix wp_ and I strongly recommend to change default prefix to the other word.

The main reason to change the prefix of the database in different installations of WordPress is to protect your WordPress database from hackers or spammers.To protect or secure your WordPress database, it is good to change its prefix to unique other keywords.

When you are installing a WordPress, you will get the option for changing the database default prefix to another one. But if you have not changed the prefix at installation time, you can change by following steps.

NOTE:Before you continue with following steps, make sure you take backup your database.

STEP 1:Edit wp-config.php

First of all,Open wp-config.php file which can be found in the WordPress root directory and replace the default prefix

wp_ to the new more secure table prefix.

Step 2: Change all WordPress table names

Next, Go to WordPress database and apply rename query to database tables to change the prefix of all tables. To rename one table at a time.

Here are Rename queries to rename the 11 tables of wordpress:

If there are other tables from plugins or other things then also rename those tables.

Step 3: UPDATE other Entries in tables

There will be some fields in the options and user meta tables which use wp_as a prefix. so You have to change them as well.
By executing the following query, you will get one row in the table so replace existing old prefix to new prefix.

NOTE: If you fail to change above prefix, you will not be able to log in afterwards with WordPress.

Finally, execute the following query, you will get some fields which use wp_ as a prefix. so You have to change them from old prefix to new prefix.Don’t miss any records from the table.

IN CLOSING

That is it, Now Test your WordPress site and to make sure everything works fine.

MUST READ:

Post Autosave Interval in WordPress
To add new URL rewrite rule in WordPress
Auto-tagging in WordPress

I hope you have enjoyed this tutorial. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Comments (1)

  1. […] for changing the database default prefix(wp_) to other one. few days ago, I have posted about “To Change Database PREFIX in WordPress” which is about to change database prefix manually after installation and which is somewhat […]

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How To use Pagination in Joomla

Posted on 12 years ago

Bhumi

How to display XML content with PHP

Posted on 11 years ago

Bhumi