How to Change the WordPress Database Prefix to Improve Security

Your WordPress database is the control center for your entire site because all of your information is stored there. Some people may try to hack your site if they know the database name. In this video, we will show you how to change the WordPress database prefix to improve your site’s security.

If you liked this video, then please Like and consider subscribing to our channel for more WordPress videos.

Text version of this tutorial:

Follow us on Twitter:

Checkout our website for more WordPress Tutorials

Summary of this Tutorial:

Start by making a backup of your database.

Then go to your root directory and fid wp-config.php

Look for the table prefix and change it to something different

Now go to phpmyadmin and change the table names

Either click each table or copy the code below to update all of your tables.

RENAME table `wp_commentmeta` TO `wp_a123456_commentmeta`;
RENAME table `wp_comments` TO `wp_a123456_comments`;
RENAME table `wp_links` TO `wp_a123456_links`;
RENAME table `wp_options` TO `wp_a123456_options`;
RENAME table `wp_postmeta` TO `wp_a123456_postmeta`;
RENAME table `wp_posts` TO `wp_a123456_posts`;
RENAME table `wp_terms` TO `wp_a123456_terms`;
RENAME table `wp_term_relationships` TO `wp_a123456_term_relationships`;
RENAME table `wp_term_taxonomy` TO `wp_a123456_term_taxonomy`;
RENAME table `wp_usermeta` TO `wp_a123456_usermeta`;
RENAME table `wp_users` TO `wp_a123456_users`;

You may need to edit tables created by any plugins.

Next query the option table and select everything with a name starting with wp_ using the query below.

SELECT * FROM `wp_a123456_options` WHERE `option_name` LIKE ‘%wp_%’

As well for the usermeta table with a meta_key using wp_ using the query below and change to your new prefix

SELECT * FROM `wp_a123456_usermeta` WHERE `meta_key` LIKE ‘%wp_%’

Related Links:

How to do a database backup


You might like

Leave a Reply

Your email address will not be published. Required fields are marked *

Claim Your Free WordPress Security Report!- Get Free Instant Access -

This site makes use of cookies which may contain tracking information about visitors. By continuing to browse this site you agree to our use of cookies.