How to rename WordPress tables prefix?

How to rename WordPress tables prefix?
 Durgesh Gupta
Share post:

Renaming the default WordPress tables prefix is one of the very important step to secure your WordPress from hacker.

There are two methods  to alter or rename WordPress tables prefix:

First Method :- To replace, rename or alter table prefix via Phpmyadmin Application table structure options.

1. Access your phypmyadmin
2. Select your database
3. In table structure check all tables from bottom as shown in screenshot 1.1
4. And choose replace table prefix option
5. To replace default WP_ prefix: Type wp in From input box and To input box type your preferred prefix for example ra_ and submit

Replacing table prefix
Replacing table prefix

Now you have successfully replaced default WordPress table prefix wp_ to your preferred table prefix.

Second Method :- To replace, rename or alter table prefix via Phpmyadmin sql commands.

Similarly if you wish you can run sql command to replace table prefix of a WordPress installation.

Syntax to replace table prefix

ALTER TABLE `fromprefix_table_name` RENAME `toprefix_table_name`;

 Example to replace a table prefix

ALTER TABLE `wp_links` RENAME `wp_links`;

Like above you have to execute the above mentioned syntax for each tables of your WordPress database.To run a sql command in phpmyadmin click on sql option from top option, write your sql code in sql   and to execute it click on go button  as shown in figure 1.2.

Figure 1.2: Phpmyadmin run sql command
Figure 1.2: Phpmyadmin run sql command

In each syntax write from prefix table name and to prefix table name correctly. Please note prefix always end with an underscore so don't forget to put underscore between prefix and actual table name.

Share post:
Top