In WordPress, how can we change the table prefix ( wp_ )?

You can change and rename the WordPress database prefix in several ways.

Change the table prefix in wp-config.php

Go to the WordPress root directory and open the wp-config.php file. Change the prefix of the table “wp_” to whatever you wish, for example, “wp_vhgfd”. Therefore, the line would look as follows:

$table_prefix  = ‘wp_vhgfd’;

Change the table prefix in the database

  • In PhpMyAdmin, open the database.
  • Select all tables that begin with the wp_ prefix.
  • Click With selected to display a drop-down menu. Select Replace table prefix from the list.
  • In the From-field, enter wp_. In the To-field, type the new name.
  • Then click Continue to make the changes.