Site’s security is a most important factor which is not ignorable. So today I will share the main reason of hacking. In fact, WordPress is an open source software which saves all data in the database. But on installation, it creates wp_ prefix and beginners don’t know to change it. Here you will read if you forgot to change default prefix then how to change database prefix via phpMyAdmin after installing of WordPress from rid of hacking.
Often hackers know the default prefix and they hit this. Default prefix support to hack a website easily. So try to change database prefix via phpMyAdmin. A database is a place where your site’s posts, theme settings, and other data saves. So when you are changing table prefix then you are securing your website’s data.
By default, there are 11 tables in the WordPress’s database. Every table has wp_ before the table’s name. Now we will change database prefix via phpMyAdmin let’s see:
Change Database Prefix phpMyAdmin
Now read steps to change database prefix via phpMyAdmin.
Find Table Prefix In phpMyAdmin
You can find default table prefix like as under. It’s essential to know the default prefix because it will help to change table prefix via phpMyAdmin. Maybe, your site’s designer has changed this without intimation. Because good designers keep in mind everything regarding SEO and security while purchasing template and designing. However, you can find default table prefix like here under:
Change Table Prefix Before Installing WordPress
If you want to change table prefix before installing WordPress. Then access the wp-config file in the downloaded software and change wp_ to which you want.
- Just extract WordPress.
- Now here you will get wp-config file. Open it via Notepad or Dreamviewer. You will find the table prefix on the end of this file.
- Just open the file and search for the below line:
$table_prefix = 'wp_';
When you will change table prefix then database tables will show replaced prefix.
Note: For example, if you want to use “Global” as a prefix then replace wp_ to global word. Don’t remove _ line.
Change Database Prefix After Installing WordPress
But if you have failed to change default table prefix before installing. Then you can change it later. Let’s see how to change database prefix after installing WordPress.
First, install maintenance mode plugin because it’s better way to give a better response to visitors.
Change Database Prefix From wp-config File
After it, access wp-config file and change default prefix. You can change it to any word.
- Login to CPanel.
- Open File Manager.
- Search here wp-config file and open it. Now search for the below line. However, you can find this by scrolling down.
$table_prefix = 'wp_';
Now just remove wp and write which you want.
Keep in mind: Before going to take a step don’t forget to take backup of your website.
Change Table Prefix via phpMyAdmin
- Login to CPanel.
- Search for phpMyAdmin.
- Now select database.
- After it runs the below query don’t forget to change “global” word to the desired word.
RENAME table `wp_commentmeta` TO `global_commentmeta`; RENAME table `wp_comments` TO `global_comments`; RENAME table `wp_links` TO `global_links`; RENAME table `wp_options` TO `global_options`; RENAME table `wp_postmeta` TO `global_postmeta`; RENAME table `wp_posts` TO `global_posts`; RENAME table `wp_terms` TO `global_terms`; RENAME table `wp_termmeta` TO `global_termmeta`; RENAME table `wp_term_relationships` TO `global_term_relationships`; RENAME table `wp_term_taxonomy` TO `global_term_taxonomy`; RENAME table `wp_usermeta` TO `global_usermeta`; RENAME table `wp_users` TO `global_users`;
It will change the default database prefix but if you have other than tables then you can change it manually.
- Now the turn to search options table and change prefix also. However, you can search by the below query.
SELECT * FROM `global_options` WHERE `option_name` LIKE '%wp_%'
- Which every you get here just change table prefix manually.
- Lastly, edit the usermeta table for changing table prefix. However, you can run the below command to search out.
SELECT * FROM `global_usermeta` WHERE `meta_key` LIKE '%wp_%'
It will give you results just change table prefix by click on edit button.
Test Your Site
Finally, you have finished your work you have successfully changed default table prefix. After it, just check your website by accessing admin area and site. Is it working well? If you face any difficulty then leave a comment and if you don’t want to take a risk then hire us. If you like the tutorial to change database prefix then follow us on Twitter.