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.
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'
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
Click Export, then click Go button:
Open the archive with code editor (find/replace capabilities are required), we’ll use the excellent free program Notepadd++:
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+Sfrom the keyboard to save the archive file.
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:
Confirm tables deletion by clicking Yes button:
Now click Import link, choose the archive file and click Go button:
Upon successful import you are going to receive like the one below:
Click on the database name – all tables are prefixed successfully with our custom 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.