How to change your WordPress Database Table Prefixes
Changing your WordPress table name prefixes may be required during a migration. Many installations of WordPress use a table prefix of ‘wp_’. Tables beginning with a known prefix like wp_, make it much easier for attackers to maliciously alter your database as they will know the names of all of the WordPress tables. Changing the table prefix to a random string makes it much much harder to execute such an attack.
You will need:
- your sFTP username and password (How to locate your login credentials)
- Your database username and password (How to locate your login credentials)
- WordPad or TextEdit (plain text editors usually installed on your computer)
- To export your database (how to “dump” (backup) your WordPress database)
Important: When doing the find and replace step, make sure you only find/replace table prefixes and do not inadvertently replace strings of text which are not table prefixes. This can happen, for example, with Woocomnmerce installations which include a string in the product tables relating to images.
Step by Step Instructions:
- Step 1 – Open your database in your Text Editor.
- Step 2 – Perform a Search and Replace on your current table prefix (in this example ‘wp_’ and replace it with a random string of characters).
- Step 3 – Login to your database and save your current database as a backup.
- Step 4 – Drop your current database.
- Step 5 – Import your updated database file.
- Step 6 – Login to your FTP client using the login credentials listed in your CRUX.
- Step 7 – Open your wp-config.php file and update your table prefix to the new prefix. Click Save.