In this guide, we explain how to change the database table prefix of your WordPress installation.
The default database table prefix for WordPress is ‘wp_’; however, we recommend changing it. The reason for this is that all your login details are stored in your database, making your WordPress tables very popular targets for hackers. Changing the prefix makes it harder for them to break in.
Step 1 – Change the table prefix in wp-config.php
Step 2 – Change the table prefix in the database
Step 3 – Replace all references to the old prefix
In some settings that are stored in your database, WordPress still refers to the old table prefix. To complete changing the prefix, you need to replace these with your new prefix.
update NEWPREFIX_usermeta set meta_key = 'NEWPREFIX_capabilities' where meta_key = 'OLDPREFIX_capabilities';
update NEWPREFIX_usermeta set meta_key = 'NEWPREFIX_user_level' where meta_key = 'OLDPREFIX_user_level';
update NEWPREFIX_usermeta set meta_key = 'NEWPREFIX_autosave_draft_ids' where meta_key = 'OLDPREFIX_autosave_draft_ids';
update NEWPREFIX_options set option_name = 'NEWPREFIX_user_roles' where option_name = 'OLDPREFIX_user_roles';
3. Replace OLDPREFIX and NEWPREFIX, with your own old and new prefix. Like in the example below, where we replace wp_ with rs_:
update rs_usermeta set meta_key = 'rs_capabilities' where meta_key = 'wp_capabilities';
update rs_usermeta set meta_key = 'rs_user_level' where meta_key = 'wp_user_level';
update rs_usermeta set meta_key = 'rs_autosave_draft_ids' where meta_key = 'wp_autosave_draft_ids';
update rs_options set option_name = 'rs_user_roles' where option_name = 'wp_user_roles';
4. Click on Go to run the commands and complete the change.
You are done. The prefix of the WordPress tables has now been changed.
NB: When copy and paste please check the symbol ‘