Wordpress table prefix

Most of the new WordPress developers don’t know what table prefix is and how important it is. So when they first time install WordPress, they keep default WordPress table prefix wp_. But it has a significant security risk, and it can make your site vulnerable to hackers.

What is WordPress Database Table Prefix?

At first, we should what is the database? A database is a data center where your website all data will be stored, such as Content, Images, videos, etc. There are some database software, but WordPress supports MySQL.

However, when installing WordPress, it creates 12 new tables in the database. And all table prefix (Pre means previous, fix means Fixed) is wp_. Such as wp_commentsdata. All 12 database has the same prefix.

Why Should We Change WordPress Database Table Prefix?

As you know, all WordPress database table has the same prefix, so it is easy for a hacker to guess and attack your website database. And the database is the central store for your site. If he change something or input something, that’s a high risk.

So it is an easy way to protect and improve the security of your website. We will show you how you can easily change the table prefix.

Modify the Table Prefix wp_ When installing WordPress

When we install WordPress, we can directly modify the table prefix. It is the easiest way to change table prefix. But unfortunately, most of the people make this mistake. But don’t worry, after also installing, you can change the table prefix, and it is straightforward.

Modifying the database is risky, so for security reasons, it is strongly recommended that you back up the database before tossing it to avoid accidents!

1: Modify Prefix Using Plugin

We will show you two plugin to change table prefix. And it is an easy way to change table prefix.

All In One WP Security & Firewall:

All in one is not just to change the table prefix, but it is a high-security plugin. And it supports to change default table prefix.

Go to Plugins>Add New and Search All In One WP Security & Firewall.

Install and activate it. Then go to WP Security>Database Security.

You can read this article on how to install a WordPress plugin.

Change WordPress database table prefix

Check the box if you want it randomly change your table prefix. Otherwise, in the below type, your preferred table prefix. Then Click Change DB Prefix. It will change your database table prefix quickly.

Change Table Prefix:

Install the Change Table Prefix plugin to modify the default table prefix. The method is straightforward; you can enter the admin panel> plugins> Add New search “Change Table Prefix” to find and click “install now.”

After the Change Table Prefix plugin is successfully installed and enabled, directly in the background> Settings> Change Table Prefix> check “Would you like to your custom prefix.”, And then fill in the table we want to modify below Prefix (such as abc_), and finally click the “Click To Change Table Prefix” button to successfully edit the table prefix.

Note: You can only use numbers, letters, and underscores like wp_hgh123_.

After refreshing, you can find that the current table prefix has changed.

Now you can delete this plugin because you no need this plugin.

Change table prefix is a plugin only to change the table prefix. But it has not
tested with the latest WordPress 5.4. So we recommend to use All in One WP Security and Firewall.

2: Modify The Table Prefix Manually

However, not everyone likes to use plugins, and some bloggers want to use their own hands to change the database. Hence, method 2 is more suitable for bloggers with relatively stable hands-on capabilities.

The steps to manually modify the table prefix are as follows:

You have to access your database from Cpanel. So log in to your site Cpanel and go to phpMyAdmin.

php my admin

If you have more that one site, then make sure which one is your website database. You can go to File Manager and open wp-config.php and make sure your database name.

Then click your right database name and go to the SQL. And paste the below code.

RENAME  table  wp_commentmeta  TO telk_commentmeta ;

RENAME  table  wp_comments TO telk_comments ;

RENAME  table  wp_links TO telk_links ;

RENAME  table  wp_options TO telk_options ;

RENAME  table  wp_postmeta TO telk_postmeta ;

RENAME  table  wp_posts TO telk_posts ;

RENAME  table  wp_termmeta TO telk_termmeta ;

RENAME  table  wp_terms TO telk_terms ;

RENAME  table  wp_term_relationships TO telk_term_relationships ;

RENAME  table  wp_term_taxonomy TO telk_term_taxonomy ;

RENAME  table  wp_usermeta TO telk_usermeta ;

RENAME  table  wp_users TO telk_users ;

Wordpress table prefix

After clicking the “Go” button, you can successfully change the table prefix to telk_. Then refresh the database; you can find that the table prefix of the database has become telk_.

Continue to click the “SQL” button and run the following SQL statement to modify the data in the options table:

update telk_options  set  option_name =  replace (option_name, ‘wp _’, ‘telk_’);

Continue to click the “SQL” button and run the following SQL statement to modify the data in the user meta table:

update telk_usermeta  set  meta_key =  replace (meta_key, ‘wp _’, ‘telk_’);

In some cases, if you have installed other plugin on your website, then it also can create some tables. So just find the table name and run SQL command. Like your table name is wp_yoast_seo

Then write the SQL code

RENAME  table  wp_yoast_seo TO telk_yoast_seo ;

It will successfully change the table name.

At this point, we finally successfully modified the default table prefix wp_ to telk_ on the WordPress site.

Note: you can add numbers, underscores, and letters. And always try to use different table prefix. Don’t keep the same table prefix as your website or don’t use common English words. Think if you were a hacker then what you guess table prefix to hack.

Conclusion

From the perspective of work efficiency, it is strongly recommended that bloggers who need to modify the WordPress default table prefix directly adopt method one. It is relatively simple to install the Change Table Prefix plugin, and the probability of errors will be much lower.

If you have any questions or face any problem when changing table prefix, then let us know. We are here to help you.

Leave a Reply