Home > Help Center > Applications > WordPress > How to Change WordPress Database Tables Prefix

How to Change WordPress Database Tables Prefix

One of the first security improvements you can apply when installing a WordPress site is to change the default database table prefix.

This can be done during the installation process either done manually or through automated installer like Softaculous.

If you missed thе opportunity to install your WordPress with custom database prefix at first and you think the chance is lost forever, we have good news for you.

In this article we’ll show you how to change your database table prefix easily and without any risk to damage the site at all.

In CPanel open File Manager and open WordPress site root folder.

Select wp-config.php file and open it with either code or code editor.

Find the row with this code:

$table_prefix = 'wp_';

Replace 'wp_' with any custom string using letters, numbers and underscores (lso be careful to not delete the surrounding single quotes): 'dm098'

change wordpress database prefix

Click Save Changes button.

Return to cPanel main screen and open phpMyAdmin from Database section.

Click on the database name (if you are not sure check wp-config.php):

change wordpress database prefix

Click Export, then click Go button:

change wordpress database prefix

Open the archive with code editor (find/replace capabilities are required), we’ll use the excellent free program Notepadd++:

change wordpress database prefix

Click Search > Replace or enter CTRL+H from the keyboard to open Replace window:

  • In the Find what field enter wp_
  • In the Replace with field enter dm098
  • Click Replace All button.
  • Click Close button.
  • Click File > Save or enter CTRL+S from the keyboard to save the archive file.

change wordpress database prefix

If we try to import the archive we are going to receive an error. That’s why we must delete all database tables (not the database itself).

Click Check All to select all tables and from the dropdown menu select Drop option:

change wordpress database prefix

Confirm tables deletion by clicking Yes button:

change wordpress database prefix

Now click Import link, choose the archive file and click Go button:

change wordpress database prefix

Upon successful import you are going to receive like the one below:

change wordpress database prefix

Click on the database name – all tables are prefixed successfully with our custom prefix:

change wordpress database prefix

Refresh the site or enter the domain in the browser – the site is working fine. Log in WP admin – all administration menus and screens are working properly.

#wordpress #database

Still not finding what you're looking for?

Contact our support team with any additional questions or concerns.

Contact support