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. Required fields are marked *

Most Popular Posts

Overview of Views in MySQL

Posted on 11 months ago

Bhumi

An Introduction to Kubernetes

Posted on 1 year ago

Bhumi

How to use SSL in WordPress

Posted on 5 years ago

Bhumi

How to connect to MySQL database using PHP

Posted on 5 years ago

Bhumi

Overview of ECMAScript 6 new Features

Updated 18 years ago

Bhumi

Getting started with Amazon Web Services

Updated 18 years ago

Bhumi

Facade implementation in Laravel

Updated 18 years ago

Bhumi

The Reader’s Poll – June 2015

Posted on 2 years ago

Bhumi

The Reader’s Poll – August 2014

Posted on 3 years ago

Bhumi

The Reader’s Poll – June 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – May 2014

Posted on 3 years ago

Bhumi

The Readers’ Poll – August 2013

Posted on 4 years ago

Bhumi