WordPress is a content management application that shops your website’s contents, posts, pages, subject matters, plugins, and themes in a database. A database is the storage of the website and incorporates every single record. While installing WordPress, humans tend to depart the prefix wp_, which is the default. This makes it the target for hackers and spammers and may run automated codes for sq. Injections. The safest way to protect your database is with the aid of changing the database prefix while setting up your WordPress web page. In this post, you’ll learn how you can make your database safe with the aid of changing the default database prefix.
public_html and select wp-config.php >> Right-click wp-config.php and Click Edit.
Right here, the default wp_ has been changed to wp_ test_
$table_prefix = ‘wp_test_’;
Please note that numbers, letters, and underscores can be used as a prefix.
After changing the wp-config.php file, you have to alternate it in your database.
From your CPanel, open phpMyAdmin and manipulate the panel to make the right entry.
In the phpMyAdmin control panel, there are 12 WordPress tables from where you have to change the prefix manually.
To change the prefix manually would be time-consuming. Here, you will execute the below-mentioned query to change the entire default prefix to the latest one.
Execute the below query in the SQL query window to alternate the prefix of the database at once.
- RENAME table `wp_commentmeta` TO `wp_test_commentmeta`;
- RENAME table `wp_comments` TO `wp_test_comments`;
- RENAME table `wp_links` TO `wp_test_links`;
- RENAME table `wp_options` TO `wp_test_options`;
- RENAME table `wp_postmeta` TO `wp_test_postmeta`;
- RENAME table `wp_posts` TO `wp_test_posts`;
- RENAME table `wp_termmeta` TO `wp_test_termmeta`;
- RENAME table `wp_terms` TO `wp_test_terms`;
- RENAME table `wp_term_relationships` TO `wp_test_term_relationships`;
- RENAME table `wp_term_taxonomy` TO `wp_test_term_taxonomy`;
- RENAME table `wp_usermeta` TO `wp_test_usermeta`;
- RENAME table `wp_users` TO `wp_test_users`;
WordPress stores all the global options in the Options table. In this table, there are some entries that also need to have their prefix changed. To retrieve a list of all the entries that are using the wp_ prefix and needs changing, use the following SQL query:
SELECT * FROM `wp_test_options` WHERE `option_name` LIKE ‘%wp_%’
The WordPress UserMeta table contains all the information about registered users, such as personalized settings. In this table, there are also a number of entries that need to have
their prefix changed. To retrieve a list of all entries that are using the wp_ prefix, use the following SQL query:
SELECT * FROM `wp_test_usermeta` WHERE `meta_key` LIKE ‘%wp_%’
NOTE:
If there are other tables created by third-party plugins, you have to change the prefix name by running the query. After changing the entire wp_ prefix, you have to check the working of your website and WordPress dashboard. Test the pages, posts, dashboard, and make sure the whole site and WordPress dashboard are working fine as before.
Now, you should make a new backup of your database just to be on the safe side.
Securing WordPress involves securing your database. The default table prefix is well-known and targeted by hackers across the Web. Changing your prefix to something obscure and difficult to guess is an easy way to stop automated attacks, malicious scripts, and other evilness from compromising your precious database.
Please checkout our WordPress Security guide at https://tinyurl.com/scnbdvo
And remember – always keep recent backups!!!
You can follow us on Twitter and Facebook.