How to make WordPress database secure by changing default WordPress table prefix?

How to make WordPress database secure by changing default WordPress table prefix?

WordPress Database Security is the most important thing. Every single piece of information stored in it, which makes hackers and bots to target for stealing information by applying SQL Injection.

WordPress Database uses a default table prefix value “wp_” for all of its database tables. Typically, every website that is running WordPress will have its database tables with this prefix and this can surely be used by the hackers or malicious bots to guess your database table names. That’s why the smartest thing to do while creating a WordPress website is to change the prefix of the database, which can be done easily.

If you forgot to change the prefix of the database table while creating your WordPress website, you can do this now by following these simple steps.

Note: It’s recommended to backup your database before performing this task.

There are two simple steps you need to follow:

Step 1. By changing the wp-config.php file:

  • Go to your WordPress root directory and search for a file named “wp-config.php”.
wp-config.php file
wp-config.php

 

 

  • Open “wp-config.php” in any code editor and search for “$table_prefix  = ‘wp_’;”
  • Change “wp_” prefix to something like “Br1G@de” or anything you like.
WordPress database table prefix
Table Prefix

 

Note: Only alphabets, numbers and underscores.

Step 2. Change database table names:

Now you need to access your database using phpMyAdmin and change the table name’s prefix with the new one we entered in “wp-config.php” file.

You will find the phpMyAdmin link in cPanel under Databases section.

phpMyAdmin Database
phpMyAdmin

 

By default there are normally total 11 tables listed

WordPress Database Default Tables
Default Tables

 

Select the SQL tab and run the simple queries and use the prefix you add in “wp-config.php” file.

RENAME table `wp_commentmeta` TO `Br1G@de_commentmeta`;
RENAME table `wp_comments` TO `Br1G@de_comments`;
RENAME table `wp_links` TO `Br1G@de_links`;
RENAME table `wp_options` TO `Br1G@de_options`;
RENAME table `wp_postmeta` TO `Br1G@de_postmeta`;
RENAME table `wp_posts` TO `Br1G@de_posts`;
RENAME table `wp_terms` TO `Br1G@de_terms`;
RENAME table `wp_term_relationships` TO `Br1G@de_term_relationships`;
RENAME table `wp_term_taxonomy` TO `Br1G@de_term_taxonomy`;
RENAME table `wp_usermeta` TO `Br1G@de_usermeta`;
RENAME table `wp_users` TO `Br1G@de_users`;

 

 Note: If you have plugins installed, you have to make changes to those tables as well same we just did it with default WordPress tables.

Leave a Reply

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

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