WordPress could be a dynamic content management system that stores your website’s substance – posts, pages, themes, and plugins – in a database.
And since the database contains imperative data (such as your login accreditations), it’s no shock that it may be a popular hacker target. Hackers develop SQL infusions, computerized scripts, and other noxious code to assault different databases, break into websites, or distribute spam comments. For this reason, it’s exceptionally vital simply secure your database and make customary reinforcements of it.
Luckily, WordPress is exceptionally adaptable and, by making little changes, you’ll secure your site’s database. Although there’s no security measure that’s ensured to be secure, you’ll be able still secure your site’s database from amateur aggressors basically by changing its default table prefix.
With this in intellect, in this post, we’ll walk you through a step by step instructional exercise to appear you how you’ll alter the WordPress database prefix.
When you install WordPress, it creates 12 tables within the database each with the wp_ prefix. Numerous individuals don’t alter the database prefix when they introduce WordPress on their site. Programmers know this and they misuse it superbly.
The great news is merely can alter the default table prefix to something that’s unclear and troublesome to figure – sort of like a mystery key or a password. There are two diverse ways you’ll be able alter your WordPress database’s tables depending upon whether you as of now have WordPress introduced on your site or not.
1: Changing The Default Database Table Prefix Some Time Recently Introducing WordPress
The most straightforward way to alter the WordPress database prefix is some time recently introducing the CMS to your site. Some time recently you introduce WordPress, explore to the wp-config.php record and scroll down until you discover $table_prefix = ‘wp_’;.
Add a password-like string of arbitrary characters to the existing prefix i.e. ‘wp_’, and you’re great to go. For occurrence, you’ll go with something like ‘wp_a1b2c3d4’ so the full line of code would be:
$table_prefix = 'wp_a1b2c3d4';
It’s vital to be beyond any doubt that since you’re changing a database table’s title, you’re as it were permitted to utilize letters, numbers, and underscores. Once you’ve changed your database prefix to something that’s troublesome to figure, spare the wp-config.php record and proceed introducing WordPress to your site.
There’s no difficult and quick run the show to this. Utilize whatever prefix you just. Like the primary thought is to create your tables’ prefix difficult to figure and it is much less demanding to do in the event that you take after the steps laid out over some time recently introducing WordPress to your site.
Be that as it may, in case you’ve as of now introduced WordPress on your site, you’ll be able still alter its prefix and secure your database.
2: Changing The Default Database Table Prefix After Installing Wordpress
In case you’ve as of now introduced the WordPress CMS to your site, you’ll alter the default database prefix by taking after these steps:
- Some time recently You Start
Since we’ll be making changes to the wp-config.php record, it is exceedingly suggested merely make a full reinforcement of your WordPress database some time recently changing the table prefix. In the event that you get a part of activity on your site at that point it would be a great thought to divert your site’s guests to a transitory upkeep page.
- Alter THE DEFAULT TABLE PREFIX
Open up your wp-config.php record found in your WordPress root catalog. Scroll down until you discover the table prefix line i.e. $table_prefix = ‘wp_’;. Alter the database prefix from ‘wp_’ to something irregular like ’wp_a1b2c3d4’.
Be beyond any doubt that since you’re changing a database table’s prefix, you’re as it were permitted to utilize letters, numbers, and underscores.
- Rename All WordPress Database Tables
Following, explore to your WordPress database through phpMyAdmin and rename all of the table prefixes to the one you indicated in your wp-config.php record. As we specified some time recently, there are a add up to of 12 default WordPress tables. One way to do that’s to rename each table physically. But that take a parcel of time. So, to create things faster, here’s a list of SQL commands that you just can run to rename all 12 of the default WordPress tables:
RENAME table `wp_commentmeta` TO `wp_ a1b2c3d4_commentmeta`; RENAME table `wp_comments` TO `wp_ a1b2c3d4_comments`; RENAME table `wp_links` TO `wp_ a1b2c3d4_links`; RENAME table `wp_options` TO `wp_ a1b2c3d4_options`; RENAME table `wp_postmeta` TO `wp_ a1b2c3d4_postmeta`; RENAME table `wp_posts` TO `wp_ a1b2c3d4_posts`; RENAME table `wp_terms` TO `wp_ a1b2c3d4_terms`; RENAME table `wp_termmeta` TO `wp_ a1b2c3d4_termmeta`; RENAME table `wp_term_relationships` TO `wp_ a1b2c3d4_term_relationships`; RENAME table `wp_term_taxonomy` TO `wp_ a1b2c3d4_term_taxonomy`; RENAME table `wp_usermeta` TO `wp_ a1b2c3d4_usermeta`; RENAME table `wp_users` TO `wp_ a1b2c3d4_users`;
On the off chance that you have got plugins introduced on your WordPress site then chances are you might have many additional tables in your database. In case so, basically rename them, as well – either physically or by altering one of the SQL commands given over.
In arrange to play down the chance of a hacking endeavor, it’s a great thought to rename all of your WordPress database tables that start with the default prefix to something arbitrary.\
- Alter The Choices Table
Following, we have to be look the choices table for any occurrences of the ancient, default prefix so able to supplant them, as well. Here’s an SQL inquiry to spare you a few time:
SELECT * FROM `wp_ a1b2c3d4_options` WHERE `option_name` LIKE '%wp_%'
The reason of this can be to discover any alternatives that start with wp_ and supplant them with the modern prefix i.e. wp_ a1b2c3d4. Running this SQL inquiry will return the wp_user_roles alternative in expansion to any other alternatives that might have been made by the plugins you’ve introduced to your site.
Once you’ve found all of the choices, rename them to the modern prefix.
- Adjust The Usermeta Tabl
Additionally, look the usermeta table for any occasions of the ancient prefix so simply can supplant it with the new prefix. Here’s an SQL inquiry to assist you out:
SELECT * FROM `wp_ a1b2c3d4_usermeta` WHERE `meta_key` LIKE ‘%wp_%’
Running this inquiry returns all of the usermeta areas that start with the wp_ prefix. Essentially rename all of them to the unused prefix.
Test To Form Beyond any doubt Everything Works
That’s it! You’re all done and your site ought to be working legitimately. To double-check that everything capacities the way it ought to, log in to your WordPress website’s back-end and test out the admin board, make a sham post (and page), and make beyond any doubt your widgets work as they ought to on the front-end.
In case everything looks great at that point you’ll rest guaranteed that you’ve effectively changed your WordPress website’s default database prefix and your database is more secure than it was some time recently.
Securing your database by changing the default prefix may be a step within the right heading when it comes to bracing your WordPress site against hacking endeavors. By changing your prefix to something that’s irregular and troublesome to figure, you’ll ensure your database from SQL infusions, mechanized scripts, and other noxious cod
At long last, keep in mind to require normal reinforcements of your WordPress website’s database. On the off chance that something ever goes off-base, you’ll continuously reestablish the most recent reinforcement and minimize the degree of harm.
What other strategies do you employ to secure your WordPress database? We’d cherish to listen from you so let us know by commenting underneath!