Latest Tech and Tips

How to Change the WordPress Database Prefix to Improve Security


WordPress Database resembles a mind for your whole WordPress website due to the fact that each and every single details is kept in there hence making it cyberpunk’s favored target. Spammers as well as cyberpunks run automated codes for SQL shots. Well, sadly lots of people neglect to change the database prefix while they mountWordPress This makes it less complicated for cyberpunks to prepare a mass assault by targeting the default prefix wp _ The most intelligent means you can shield your database is by transforming the database prefix which is truly simple to do on a website that you are establishing. But it takes a couple of actions to change the WordPress database prefix correctly for your recognized website without totally messing it up.

Video Tutorial

Subscribe to WPBeginner

If you do not such as the video clip or require even more directions, after that proceed analysis.


We advise that you backup your WordPress Database prior to you do anything recommended in this tutorial. It is essential to maintain day-to-day back-ups of your website, we advise Backup Buddy plugin for doing that. Next point we advise is that you reroute your site visitors to a short-lived upkeep web page.

Change Table Prefix in wp-config. php

Open your wp-config. php data which lies in your WordPress origin directory site. Change the table prefix line from wp _ to another thing such as this wp_a123456 _

So the line would certainly resemble this:

$ table_prefix='wp_a123456 _';

Note: You can just change it to numbers, letters, as well as emphasizes.

Change all Database Tables Name

You requirement to gain access to your database (more than likely with phpMyAdmin), and afterwards change the table names to the one we defined in wp-config. php data. If you are making use of the cPanel WordPress organizing, after that you can locate the phpMyAdmin web link in your cPanel. Look at the picture listed below:


There are a total amount of 11 default WordPress tables, so transforming them by hand would be discomfort.

SQL Query

That’s why to make points quicker, we have a SQL inquiry that you can utilize.

RELABEL table 'wp_commentmeta' TO 'wp_a123456_commentmeta';.
RELABEL table 'wp_comments' TO 'wp_a123456_comments';.
RELABEL table 'wp_links' TO 'wp_a123456_links';.
RELABEL table 'wp_options' TO 'wp_a123456_options';.
RELABEL table 'wp_postmeta' TO 'wp_a123456_postmeta';.
RELABEL table 'wp_posts' TO 'wp_a123456_posts';.
RELABEL table 'wp_terms' TO 'wp_a123456_terms';.
RELABEL table 'wp_termmeta' TO 'wp_a123456_termmeta';.
RELABEL table 'wp_term_relationships' TO 'wp_a123456_term_relationships';.
RELABEL table 'wp_term_taxonomy' TO 'wp_a123456_term_taxonomy';.
RELABEL table 'wp_usermeta' TO 'wp_a123456_usermeta';.
RELABEL table 'wp_users' TO 'wp_a123456_users';.

You might have to include lines for various other plugins that might include their very own tables in the WordPress database. The suggestion is that you change all tables prefix to the one that you desire.

The Options Table

We requirement to search the choices table for any kind of various other areas that is making use of wp _ as a prefix, so we can change them. To relieve up the procedure, utilize this inquiry:

 SELECT * FROM 'wp_a123456_options' WHERE 'option_name 'LIKE'% wp _%'

This will certainly return a great deal of outcomes, as well as you require to go one at a time to change these lines.

Use rMeta Table

Next, we require to search the usermeta for all areas that is making use of wp _ as a prefix, so we can change it. Use this SQL inquiry for that:

 SELECT * FROM 'wp_a123456_usermeta' WHERE 'meta_key 'LIKE' % wp _ %' (* )of access might differ on the number of plugins you are making use of as well as such. 

Number change every little thing that has wp _ Just brand-new the as well as

Backup are currently prepared Done

You examination to website. the you adhered to If over actions, after that every little thing needs to be functioning penalty. the, you must make a brand-new back-up of your database simply Now get on to secure side.the