How To Change Default Table Prefix (wp_) In WordPress

Default table prefix (which is wp_) is something which nobody cares about while installing the WordPress or in the beginning days of his WordPress blog. But when the website grows, security becomes a concern and we look back at the flaws in our existing WordPress installation. But we can not afford a new installation just to repair a couple of loopholes. Good thing is that we can change the table prefix of our WordPress database anytime. Even better thing is that it is pretty easy as well. So read on.

What this table prefix does anyways?

WordPress runs on MySQL databases. Each database has some tables in it. WordPress prefixes each table it creates with a prefix. The default prefix is wp_. What this simple hook does is that each table created by WordPress starts with an identifier. It means:

table users becomes wp_users,
table posts becomes wp_posts and so on…

The advantage is that all tables related to your WordPress installation are marked and grouped. You can now use the same database for another WordPress installation or in fact any other need like other CMS or shopping cart or forum. Though most hosting packages come with unlimited databases, this should not stop WordPress giving you ability to install multiple WordPress instances in a single database. There is no harm in it anyways.

To install another WordPress though you will need to use a different prefix say wp2_ so that thing do not get mixed up. You can find your table prefix in your wp-config.php file.

The problem with default table prefix wp_.

Most manual installations (and many one click auto installations) of WordPress do not care to change the default prefix. And why should they care? They are never going to use this database for another installation.

The problem is, It’s predictable.

Though nobody is going to read your database tables unless he has a database user and password, SQL injections are always threat. It means a hacker can predict what table names your website is using even without knowing your database name, username or password. A list of all tables created by WordPress, (if default prefix is used) is here. By using a prefix other than default you give your hacker some extra hard time because now he has to find the table names first.

How to change default table prefix in existing WordPress website.

Using plugins

There are many plugins for this exact task, but many of them have several issues. This plugin does that for you automatically. Just remember backup your website before and after using this plugin. Also remember to uninstall and delete this plugin after your prefix is changed successfully because you will never need it again.

The manual method