Are you running a WordPress site and want to secure your site from hackers/attackers? There is very easy for hackers to inject the SQL injection in your WordPress site if you have used the default table prefix during your WordPress standard installation because of everyone know the WordPress default table prefix that is “wp_” and it is easy to attack your site by using the SQL injection, then why not change the default table prefix from “wp_” to something else.
It is also recommended by many WordPress experts to change the WordPress database prefix to improve security. Before the change the table prefix please make sure you have taken backup of your site database and wp-config.php file and also make sure wp-config.php file in writeable mode.
Login in your database by using the PHPMyAdmin and select your site database. Now open SQL tab and copy paste below SQL queries then click on the Go button to execute.
RENAME table `wp_commentmeta` TO `wp8xant_commentmeta`;
RENAME table `wp_comments` TO `wp8xant_comments`;
RENAME table `wp_links` TO `wp8xant_links`;
RENAME table `wp_options` TO `wp8xant_options`;
RENAME table `wp_postmeta` TO `wp8xant_postmeta`;
RENAME table `wp_posts` TO `wp8xant_posts`;
RENAME table `wp_terms` TO `wp8xant_terms`;
RENAME table `wp_termmeta` TO `wp8xant_termmeta`;
RENAME table `wp_term_relationships` TO `wp8xant_term_relationships`;
RENAME table `wp_term_taxonomy` TO `wp8xant_term_taxonomy`;
RENAME table `wp_usermeta` TO `wp8xant_usermeta`;
RENAME table `wp_users` TO `wp8xant_users`;
After changing the table prefix login in your website by using the FileZilla FTP client and open wp-config.php file. Now change the table prefix line from “wp_” to something else like this “wp8xant_”. It should look like:
$table_prefix = 'wp8xant_';
Now change into options and user meta tables by executing the bellow SQL queries.
UPDATE wp8xant_options SET option_name = REPLACE(option_name, 'wp_', 'wp8xant_') WHERE `option_name` LIKE '%wp_%';
UPDATE wp8xant__usermeta SET meta_key = REPLACE(meta_key, 'wp_', 'wp8xant_') WHERE `meta_key` LIKE '%wp_%';
You can also use Change Table Prefix WordPress plugin to change your WordPress table prefix. I have used this plugin in many websites to change table prefix. The latest version of this plugin is compatible with WordPress multisite installation as well. Below are some features of this plugin:
The installation of this plugin is very simple and easy like other plugins are. If you have just started with WordPress, then check out:
After the installation of this plugin activate it by clicking on Activate button via Plugins => Installed Plugins menu option. Now navigate to the Settings => Change Table Prefix option to change your table prefix and click on the Click to change table prefix button.
By default, it will generate the random table prefix and if you want to change as you want then marked checked the checkbox and enter the table prefix as you want to change.
If you still need any help to change table prefix, then feel free to put your comments in below comment section. I will be happy to help in changing the database table prefix for your website. Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials.
Tags: change prefix, database prefix, prefix change, table prefix, what is table prefix, what is wordpress table prefix, wordpress database table prefix, wordpress tutorial, wordpress tutorial for beginner, wordpress tutorial for beginners, wordpress tutorials, wordpress tutorials for beginners